Fix panic when encoding undef scalars#66
Fix panic when encoding undef scalars#66dankogai merged 1 commit intodankogai:masterfrom joyrex2001:master
Conversation
|
That is not fix! It just hides this bug, which is probably in Encode.xs. If you call ->encode method directly on object then it will still crash. So please drop this patch |
|
Real problem is in Encode.xs, Method_encode_xs at line: This does not handle undefined values correctly. |
|
Looks like this problem is related to these reported bugs: |
|
!!!! Why merging? This patch is totally incorrect! I suggest to immediately revert it and it fix properly! |
|
The fix may not be perfect but I wanted to merge the test. Also note that the encoder object that |
…ment in all XS functions Before this patch every function XS function did it differently and not every one correctly. Now SvPV_force_nomg() is used when source argument is going to be modified. SvGETMAGIC() is called when entering into functions and then only "nomg" variants of perl functions are used to prevent processing get magic more times. SvSETMAGIC() is called after modification of source argument. This fixes bugs: https://rt.cpan.org/Public/Bug/Display.html?id=117158 https://rt.cpan.org/Public/Bug/Display.html?id=85489 dankogai#66
|
Proper fix is here: #70 |
…ment in all XS functions Before this patch every function XS function did it differently and not every one correctly. Now SvPV_force_nomg() is used when source argument is going to be modified. SvGETMAGIC() is called when entering into functions and then only "nomg" variants of perl functions are used to prevent processing get magic more times. SvSETMAGIC() is called after modification of source argument. This fixes bugs: https://rt.cpan.org/Public/Bug/Display.html?id=117158 https://rt.cpan.org/Public/Bug/Display.html?id=85489 dankogai#66
…ment in all XS functions Before this patch every function XS function did it differently and not every one correctly. Now SvPV_force_nomg() is used when source argument is going to be modified. SvGETMAGIC() is called when entering into functions and then only "nomg" variants of perl functions are used to prevent processing get magic more times. SvSETMAGIC() is called after modification of source argument. This fixes bugs: https://rt.cpan.org/Public/Bug/Display.html?id=117158 https://rt.cpan.org/Public/Bug/Display.html?id=85489 dankogai#66
This pull request will fix the "panic: sv_setpvn called with negative strlen at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/Encode/Encoder.pm line 84" error, when you will try to Encoder::encode a undefined scalar. See also the accompanied unit test (t/undef.t).