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

Re: [perl #132630] Assertion failure in Perl_fbm_instr (util.c:816)

Thread Previous
February 7, 2018 22:09
Re: [perl #132630] Assertion failure in Perl_fbm_instr (util.c:816)
Message ID:
On 7 February 2018 at 22:35, Karl Williamson via RT
<> wrote:
> I looked at this briefly.  It looks like an issue where something is expecting a NUL-terminated C string, but the data contains an embedded NUL.  Scanning through the fbm code, I saw only operation that allowed embedded NULs.

Run it with -Mre=Debug,ALL
Matching REx "^000?\0000" against "0%x{1000000}"
UTF-8 string...
Intuit: trying to determine minimum start position...
  substrs[0]: min=0 max=0 end shift=2 useful=100 utf8=1 [PVMG("00"\0)
[UTF8 "00"]]
  substrs[1]: min=2 max=3 end shift=0 useful=100 utf8=1
[PVMG("\0000"\0) [UTF8 "\x{0}0"]]
  substrs[2]: min=2 max=3 end shift=0 useful=100 utf8=1
[PVMG("\0000"\0) [UTF8 "\x{0}0"]]
  At restart: rx_origin=0 Check offset min: 2 Start shift: 2 End shift
0 Real end Shift: 0
[assert goes here]

The string is only two characters long, and the string we are looking
for "\x{0}0" has to be found at position 2 or later.

We are falling into the block at around 1253 of regexec.c where we
recompute the endpoint, and we dont take into account that doing so
could move the endpoint to before the start point.

Fixed in 12453e29a22d63862ba5924c61c08baabd9c6782


I think this can be closed.


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