develooper Front page | perl.perl5.porters | Postings from April 2010

Re: [perl #73814] unpack leads to segmentation fault

Thread Previous | Thread Next
From:
Tony Cook
Date:
April 23, 2010 02:57
Subject:
Re: [perl #73814] unpack leads to segmentation fault
Message ID:
20100423095651.GA17396@mars.tony.develop-help.com
On Fri, Mar 26, 2010 at 10:57:27AM +0100, Rafael Garcia-Suarez wrote:
> On 25 March 2010 14:17, Marcela Maslanova <perlbug-followup@perl.org> wrote:
> > Description of problem:
> >
> > $ perl -e 'use bytes;
> > print join(",",split(/../,unpack("%02H*","hello world")))'
> > Segmentation fault
> 
> Shorter test case :
> 
> $ ./perl -e 'split/a/,unpack("%02H*","a")'
> Segmentation fault
> 
> Looks like split has difficulties with its argument list there, which
> boils down apparently to unpack returning too many values :
> 
> $ perl -le 'print for scalar unpack("%02H*","a")'
> 61
> 0

The H and u formats were returning the unpack()ed text as well as the
checksum.

Patch with tests attached.

Tony

Thread Previous | Thread Next


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