forked from Perl/perl5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix "uninitialized value" warnings for shift()/pop()
This fixes an oversight introduced in 1b0ae12. The Perl code "shift" (or "shift()") produces different optrees depending on where it occurs: At file scope, it shifts @argv and the corresponding OP has an explicit @argv child. But at subroutine scope, it shifts @_, and @_ is not represented explicitly in the optree. Instead the parser just generates an OP_SHIFT without any children. This latter case was not handled in S_find_uninit_var (and blindly accessing a non-existent child OP would crash perl). pop() was similarly affected. Fix: Explicitly check whether OPf_KIDS is set on the OP before accessing the op_first field (plus some tests for this case). Fixes Perl#21960.
- Loading branch information
Showing
2 changed files
with
30 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters