-
Notifications
You must be signed in to change notification settings - Fork 551
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
Segmentation fault in S_scan_heredoc() #14462
Comments
From thecrux@gmail.comSigsegv testcase: $ echo -n '/$a[/<<' | perl (gdb) run (gdb) bt (gdb) frame 1 Crash reproduced with perl 5.18, 5.20, 5.21.8 |
From @cpansproutOn Sun Feb 01 13:26:13 2015, crux wrote:
This is likely related to #123617, though it appears to be more recent. I’m running a bisect. -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Sun Feb 01 14:38:39 2015, sprout wrote:
4efe39d is the first bad commit toke.c:scan_heredoc: Merge similar code -- Father Chrysostomos |
From @hvdsOn Sun Feb 01 14:41:10 2015, sprout wrote:
The below is one aspect changed from the original, and is enough to make it survive (and pass tests); I'm not sure why reality doesn't match the various comments though (so that we're here with !infile and !PL_lex_inwhat, and it isn't an eval, and doesn't have a newline), so I'm not sure how to fix those. Hugo Inline Patchdiff --git a/toke.c b/toke.c
index 24b5ed0..13f30e7 100644
--- a/toke.c
+++ b/toke.c
@@ -9275,7 +9275,8 @@ S_scan_heredoc(pTHX_ char *s)
}
else { /* eval */
s = (char*)memchr((void*)s, '\n', PL_bufend - s);
- assert(s);
+ if (!s)
+ s = PL_bufend;
}
linestr = shared->ls_linestr;
bufend = SvEND(linestr); |
From @cpansproutOn Tue Feb 10 10:15:07 2015, hv wrote:
A call to skipspace that happens inside /$a[/ tries to read the next line of the file. When EOF is reached PL_rsfp is set to NULL, which is why S_scan_heredoc thinks we are inside an eval, which is not the case. A similar circumstance can arise with: perl -e 'print q|/$a[<<end]/+<<| . "\nend"'|./miniperl which does indeed make S_scan_heredoc think it is in an eval, but the first line does end with \n, so the memchr returns something and the assertion does not fail. scan_heredoc’s assumptions are reasonable. I think we need to fix that /$a[/ bug, which will unfortunately break my japhs. :-( -- Father Chrysostomos |
From @cpansproutOn Tue Feb 10 12:38:15 2015, sprout wrote:
I have finally fixed this in e47d32d. What I said about skipspace was not correct. skipspace was doing the right thing, but many other paths were calling lex_read_space or lex_next_chunk without the proper guards. But putting guards all over the place seemed the wrong approach, so I modified lex_next_chunk instead. -- Father Chrysostomos |
From @cpansproutOn Sun Feb 15 17:39:17 2015, sprout wrote:
I followed up with another fix in d27f4b9. A similar case was still crashing. -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'pending release' |
From @khwilliamsonThanks for submitting this ticket The issue should be resolved with the release today of Perl v5.22, available at http://www.perl.org/get.html -- |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
From @karenetheridgeOn Mon Jun 01 20:50:31 2015, khw wrote:
For tracability, this fix appears to also have been backported to perl 5.20.3, so the resulting BBC bug https://rt.perl.org/Public/Bug/Display.html?id=123865 is also in 5.20.3 (therefore Devel-Declare's fixes are needed for 5.20.3 as well). |
Migrated from rt.perl.org#123712 (status was 'resolved')
Searchable as RT123712$
The text was updated successfully, but these errors were encountered: