develooper Front page | perl.perl5.porters | Postings from March 2019

[perl #133888] Assertion failure in glob3 (bsd_glob.c:759)

From:
Tony Cook via RT
Date:
March 27, 2019 03:59
Subject:
[perl #133888] Assertion failure in glob3 (bsd_glob.c:759)
Message ID:
rt-4.0.24-19885-1553659155-1656.133888-15-0@perl.org
On Sun, 03 Mar 2019 11:33:07 -0800, randir wrote:
> This is a bug report for perl from sergey.aleynikov@gmail.com,
> generated with the help of perlbug 1.41 running under perl 5.29.9.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> While fuzzing perl v5.29.8-21-gde59f38ed9 built with afl and run
> under libdislocator, I found the program attached to this message to
> cause an assertion failure:
> 
> perl: bsd_glob.c:759: int glob3(Char *, Char *, Char *, Char *, Char
> *, Char *, Char *, glob_t *, size_t *): Assertion `restpattern <
> restpattern_last' failed.
> 

I believe this is an error in the assertion.

The pattern in this case is exactly 4095 bytes long, you can reproduce this with:

 my $str = ("0" x 4094) . "?";
 glob $str;

At the point of the call to glob3() restpattern points one past the end of the pattern (ie. at the terminating NUL for a simple glob) and restpattern_last points at the last byte in the buffer (*not* one past the end) ie. patbuf + MAXPATHLEN -1 (patbuf in glob0()).

So in this case they're equal and the assertion fails.

Tony

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=133888



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