Skip Menu |
Report information
Id: 123816
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: hv <hv [at] crypt.org>
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: 5.22.0



Subject: stat should not stack
AFL (<http://lcamtuf.coredump.cx/afl>) finds this: % ./miniperl -e 'stat-t' miniperl: op.c:721: Perl_op_free: Assertion `!(o->op_private & ~PL_op_private_valid[type])' failed. Aborted (core dumped) % When trying to stack filetests, ck_ftst() checks that the kid is not a stat or lstat, but doesn't check the parent. I think the fix is just to add the check: --- a/op.c +++ b/op.c @@ -9876,8 +9876,10 @@ Perl_ck_ftst(pTHX_ OP *o) } if ((PL_hints & HINT_FILETEST_ACCESS) && OP_IS_FILETEST_ACCESS(o->op_type)) o->op_private |= OPpFT_ACCESS; - if (PL_check[kidtype] == Perl_ck_ftst - && kidtype != OP_STAT && kidtype != OP_LSTAT) { + if (type != OP_STAT && type != OP_LSTAT + && PL_check[kidtype] == Perl_ck_ftst + && kidtype != OP_STAT && kidtype != OP_LSTAT + ) { o->op_private |= OPpFT_STACKED; kid->op_private |= OPpFT_STACKING; if (kidtype == OP_FTTTY && ( .. and will push that with a test if nobody disagrees. Hugo
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 237b
Now fixed with 87ebf1e3df: [perl #123816] fix stat stacking The check function for filetests avoids treating '-t stat' as a pair of stackable filetests, but needs also to avoid treating 'stat -t' as stackable. Hugo
Download (untitled) / with headers
text/plain 200b
Thank you for submitting this ticket. The issue should now be resolved with the release today of Perl v5.22, which is available at http://www.perl.org/get.html -- Karl Williamson for the Perl 5 team


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org