develooper Front page | perl.perl5.porters | Postings from July 2018

Re: [perl #133365] perl 5.28.0 core: Negative array index read inutf8.c and regexec.c

Thread Previous | Thread Next
Karl Williamson
July 13, 2018 15:44
Re: [perl #133365] perl 5.28.0 core: Negative array index read inutf8.c and regexec.c
Message ID:
On 07/13/2018 12:15 AM, Marc-Philip via RT wrote:
> On Thu, 12 Jul 2018 13:05:46 -0700, wrote:
>> The reason it isn't checked is because it can't happen.  I suppose we
>> could panic.  If it were to return negative it would mean the hardware
>> or the memory or something was so corrupt that soldiering on wouldn't
>> make sense.
> Hi Karl,
> thank you for explaining. But then, I still wonder. This Perl__invlist_search in regcomp.c, that we're talking about: It has two places where it can return -1 in blead today. If this can't happen, why is this error handling code there? You've added the function back in 2011 with commit d5e82ecc146, and this "first version" of it also could return -1.
> T&R
> Marc-Philip

Sorry for the earlier incomplete explanation.  A general inversion list 
can fail to find the searched for item, so it has to have a way to 
signal failure.  Most of the uses in the perl core are of this type, and 
do check the return code.

But an inversion map is a data structure that happens to contain an 
inversion list, and that inversion list, of necessity, matches 
everything possible, so the return need not be checked.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About