-
Notifications
You must be signed in to change notification settings - Fork 577
panic: sv_len_utf8 cache 1 real 0 for at #17737
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
Comments
Here's a slightly simpler version:
I think something in pp_reverse should be calling magic_setutf8() on TARG, either directly or indirectly, but I've no idea at what point it should be doing that. I'm mildly surprised it didn't happen on the setsv(). The result, as far as I can tell, is that the utf8 pos/len cache on TARG persists from the first split result ("\x{100}") to the second (empty string) without its data being updated. I suspect also that whatever is going wrong here, the same pattern may occur in other places too. Not sure who knows more about utf8 pos/len caching - @khwilliamson, @tonycoz? |
sv_setsv() doesn't do set magic, which can be confusing. There's a macro SvSetMagicSV() which does do the magic. We have had this happen before, I'll have a look over core to see if I can find any other examples. |
related to Perl#17737 and fixes Perl#17739
I found one other case of sv_setsv() without a needed SvSETMAGIC() where I could make a test case indicating a problem. Code like:
is optimized to a single OP_INDEX with flags indicating the comparison and the assignment. The assignment (via sv_setsv()) doesn't call SvSETMAGIC(). This optimization had another problem in that the assignment was returning the constant assigned to the lexical rather than the lexical lvalue itself. Both issues are fixed in my https://github.com/tonycoz/perl5/tree/17737-make-reverse-magical branch. which I'll make into a PR once CI is done. There might be similar problem around line 1301 of gv.c, but I couldn't think of a way to make any misbehaviour visible. |
Thanks @tonycoz++ |
related to Perl#17737 and fixes Perl#17739 re-work of my original patch that only pushes the final result
This is a bug report for perl from [email protected],
generated with the help of perlbug 1.41 running under perl 5.31.10.
[Please describe your issue here]
While fuzzing perl v5.31.9-70-g0c96aa4b7b built with afl and run
under libdislocator, I found the following program
to emit panic():
panic: sv_len_utf8 cache 1 real 0 for at
GDB stack trace at the point of croak() is:
This is a regression between 5.26 and 5.28, bisect points to 47836a1 is the first bad commit
commit 47836a1
Author: Zefram [email protected]
Date: Fri Dec 8 19:23:29 2017 +0000
The text was updated successfully, but these errors were encountered: