Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #62646] Maximum string length with substr

0 views
Skip to first unread message

Zefram

unread,
Jan 5, 2010, 5:18:42 PM1/5/10
to perl5-...@perl.org
Attached patch should fix bug #62646.

-zefram

d1

Zefram

unread,
Jan 5, 2010, 5:25:36 PM1/5/10
to perl5-...@perl.org
Nicholas Clark wrote:
>Any reason for $w-- right at the end, instead of just $w?

Bah. No, that's an editing mistake.

-zefram

Nicholas Clark

unread,
Jan 5, 2010, 5:24:06 PM1/5/10
to Zefram, perl5-...@perl.org
On Tue, Jan 05, 2010 at 10:18:42PM +0000, Zefram wrote:
> Attached patch should fix bug #62646.

> +++ b/t/re/substr.t

> @@ -682,4 +682,19 @@ is($x, "\x{100}\x{200}\xFFb");
> is(substr($a,1,1), 'b');
> }
>
> +# [perl #62646] offsets exceeding 32 bits on 64-bit system
> +SKIP: {
> + skip("32-bit system", 4) unless ~0 > 0xffffffff;
> + my $a = "abc";
> + my $r;
> + $w = 0;
> + $r = substr($a, 0xffffffff, 1);
> + is($r, undef);
> + is($w, 1);
> + $w = 0;
> + $r = substr($a, 0xffffffff+1, 1);
> + is($r, undef);
> + is($w--, 1);
> +}
> +
> }

Any reason for $w-- right at the end, instead of just $w?

Nicholas Clark

Eric Brine

unread,
Jan 5, 2010, 5:58:28 PM1/5/10
to Zefram, perl5-...@perl.org
On Tue, Jan 5, 2010 at 5:18 PM, Zefram <zef...@fysh.org> wrote:

> Attached patch should fix bug #62646.
>

The patch doesn't change mg.c. Does that mean it doesn't fix lvalue subtr?

Zefram

unread,
Jan 5, 2010, 6:16:53 PM1/5/10
to perl5-...@perl.org
Eric Brine wrote:
>The patch doesn't change mg.c. Does that mean it doesn't fix lvalue subtr?

Oh, missed that. And upon looking further, it seems that #62646 has
widened in scope to consider all other string ops, which I didn't look at.
Jesse, as a 5.12 blocker, are you concerned just with substr, or with
all string ops?

-zefram

Jesse Vincent

unread,
Jan 8, 2010, 1:54:00 PM1/8/10
to Zefram, perl5-...@perl.org

Actually, it looks like this was nicholas' blocker.

I'd certainly rather a partial solution than no solution, so long as
we're not making a full fix harder.

>
> -zefram
>

signature.asc

Rafael Garcia-Suarez

unread,
Jan 15, 2010, 11:17:17 AM1/15/10
to Zefram, perl5-...@perl.org
2010/1/5 Zefram <zef...@fysh.org>:

> Attached patch should fix bug #62646.

Thanks, applied to bleadperl as
b6d1426f94a845fb8fece8b6ad0b7d9f35f2d62e. I won't mark this bug fixed,
since it doesn't apply to lvalue substr, and since probably other
string functions have the limitation; however we may consider taking
it off the 5.12-blockers list.

Nicholas Clark

unread,
Jan 15, 2010, 11:23:40 AM1/15/10
to perl5-...@perl.org

I feel that the lvalue substr bug should remain on the blockers list, for now.

Nicholas Clark

0 new messages