From: Marc-Andre Lafortune Date: 2013-03-25T11:14:23+09:00 Subject: [ruby-core:53707] Re: [ruby-core:53689] Re: [ruby-core:53685] Re: [ruby-core:53680] Re: [ruby-core:53679] Why doesn’t String#+ return an untrusted result if self or other is untrusted? --bcaec544ebb078330c04d8b642f5 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Seems like a bug to me. I filed #8161 (and 8162 for the doc). On Sun, Mar 24, 2013 at 4:58 AM, Nikolai Weibull wrote: > On Sat, Mar 23, 2013 at 10:42 PM, Nikolai Weibull wrote: > > On Sat, Mar 23, 2013 at 8:30 PM, KOSAKI Motohiro > > wrote: > >> On Sat, Mar 23, 2013 at 2:45 PM, Nikolai Weibull wrote: > > >>> Why doesn=92t String#+ return an untrusted result if self or other is > untrusted? > > >> IIUC, untrusted mean an object was created from untrusted code (i.e. > $SAFE >=3D3). > > > OK, so the reasoning then is that since String#+ creates a result that > > contains data from outside of the receiver, untrust isn=92t inherited, > > whereas with String#slice and String#downcase the whole result comes > > from an untrusted source and thus untrust is inherited. > > (This explanation isn=92t consistent with String#center, String#ljust, > and String#rjust, as their results inherit untrust from the padding > argument, so there must be something deeper going on here.) > > --bcaec544ebb078330c04d8b642f5 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
Seems like a bug to me.

I filed #8161 (= and 8162 for the doc).


On Sun, Mar 24, 2013 at 4:58 AM, Nikolai Weibull <now@bitw= i.se> wrote:
On Sat, Mar 23, 2013 at 10= :42 PM, Nikolai Weibull <now@bitwi.se> wrote:
> On Sat, Mar 23, 2013 at 8:30 PM, KOSAKI Motohiro
> <
kosaki.motohiro@gmail= .com> wrote:
>> On Sat, Mar 23, 2013 at 2:45 PM, Nikolai Weibull <now@bitwi.se> wrote:

>>> Why doesn=92t String#+ return an untrusted result if self or o= ther is untrusted?

>> IIUC, untrusted mean an object was created= from untrusted code (i.e. $SAFE >=3D3).

> OK, so the reasoning then is that since String= #+ creates a result that
> contains data from outside of the receiver, untrust isn=92t inherited,=
> whereas with String#slice and String#downcase the whole result comes > from an untrusted source and thus untrust is inherited.

(This explanation isn=92t consistent with String#center, String#ljust= ,
and String#rjust, as their results inherit untrust from the padding
argument, so there must be something deeper going on here.)


--bcaec544ebb078330c04d8b642f5--