Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stat should not stack #14499

Closed
p5pRT opened this issue Feb 13, 2015 · 5 comments
Labels

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Feb 13, 2015

Migrated from rt.perl.org#123816 (status was 'resolved')

Searchable as RT123816$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Feb 13, 2015

From @hvds

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Feb 16, 2015

From @hvds

Now fixed with 87ebf1e​:

  [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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Feb 16, 2015

@hvds - Status changed from 'new' to 'pending release'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 2, 2015

From @khwilliamson

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

@p5pRT p5pRT closed this Jun 2, 2015
@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 2, 2015

@khwilliamson - Status changed from 'pending release' to 'resolved'

@p5pRT p5pRT added the Severity Low label Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.