This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH: [perl #133347] Tk broken
authorKarl Williamson <khw@cpan.org>
Fri, 29 Mar 2019 00:22:11 +0000 (18:22 -0600)
committerKarl Williamson <khw@cpan.org>
Fri, 29 Mar 2019 00:54:51 +0000 (18:54 -0600)
This was caused by utf8_to_uvchr() failing to set the returned ptr
in some circumstances, leading to reading uninitialized memory.

A test failure remains, and I'll wait for Slaven's feedback before
looking further into that.  It is in t/photo.t

 couldn't recognize image data at blib/lib/Tk/Image.pm line 21.
 # Looks like your test exited with 255 just after 100

And it's trying at that point to look at 'Xcamel.gif'

utf8.c

diff --git a/utf8.c b/utf8.c
index b9772b4..e479400 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -5481,6 +5481,9 @@ Perl_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen)
      * handled the same way, speeding up this common case */
 
     if (UTF8_IS_INVARIANT(*s)) {  /* Assumes 's' contains at least 1 byte */
+        if (retlen) {
+            *retlen = 1;
+        }
         return (UV) *s;
     }