develooper Front page | perl.perl5.porters | Postings from December 2004

[perl #7678] substr reference core dump

From:
Steve Peters via RT
Date:
December 31, 2004 12:06
Subject:
[perl #7678] substr reference core dump
Message ID:
rt-3.0.11-7678-104949.12.3320584057277@perl.org
> [RT_System - Wed Sep 12 00:19:22 2001]:
> 
> The below at least replaces the core dump with an error:
> 
> $ ./perl -wle '$b="abcde"; local $k; *k=\substr($b, 2, 1)'
> Can't modify non-existent substring.
> 
> Change 12005 by jhi@alpha on 2001/09/12 13:14:59
> 
> 	Subject: [ID 20010912.007] substr reference core dump
> 	From: me-01@ton.iguana.be
> 	Date: 12 Sep 2001 14:11:16 -0000
> 	Message-Id: <20010912141116.6058.qmail@quasar.home.lunix>
> 
> Affected files ...
> 
> ... //depot/perl/mg.c#197 edit
> 
> Differences ...
> 
> ==== //depot/perl/mg.c#197 (text) ====
> Index: perl/mg.c
> --- perl/mg.c.~1~	Wed Sep 12 17:17:27 2001
> +++ perl/mg.c	Wed Sep 12 17:17:27 2001
> @@ -1506,7 +1506,7 @@
>  	sv_insert(lsv, lvoff, lvlen, tmps, len);
>  	SvUTF8_on(lsv);
>      }
> -    else if (SvUTF8(lsv)) {
> +    else if (lsv && SvUTF8(lsv)) {
>  	sv_pos_u2b(lsv, &lvoff, &lvlen);
>  	tmps = (char*)bytes_to_utf8((U8*)tmps, &len);
>  	sv_insert(lsv, lvoff, lvlen, tmps, len);
> End of Patch.
> 

Patch applied and in current Perls.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About