]> granicus.if.org Git - python/commitdiff
Fix a potentially invalid memory access of CJKCodecs' shift-jis
authorHye-Shik Chang <hyeshik@gmail.com>
Mon, 5 Jun 2006 00:59:54 +0000 (00:59 +0000)
committerHye-Shik Chang <hyeshik@gmail.com>
Mon, 5 Jun 2006 00:59:54 +0000 (00:59 +0000)
decoder.  (found by Neal Norwitz)

Misc/NEWS
Modules/cjkcodecs/_codecs_jp.c

index 6f5a90e27a4bf5e3f336d1e93e7f226f0be1d810..f5a225f412e6e2a94765ca7e47fb35324ec89896 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -75,6 +75,8 @@ Core and builtins
 Extension Modules
 -----------------
 
+- Fixed a potentially invalid memory access of CJKCodecs' shift-jis decoder.
+
 - Patch #1478788 (modified version): The functional extension module has
   been renamed to _functools and a functools Python wrapper module added.
   This provides a home for additional function related utilities that are
index 9b8d324f56bd26d67587c63a414816f4223c7ef9..f49a10b10133e16beb0117e669f52d82869d2810 100644 (file)
@@ -639,10 +639,11 @@ DECODER(shift_jis_2004)
                REQUIRE_OUTBUF(1)
                JISX0201_DECODE(c, **outbuf)
                else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)){
-                       unsigned char c1, c2 = IN2;
+                       unsigned char c1, c2;
                        ucs4_t code;
 
                        REQUIRE_INBUF(2)
+                       c2 = IN2;
                        if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc)
                                return 2;