]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
(Backport from trunk) Fix a potentially invalid memory access of
authorHye-Shik Chang <hyeshik@gmail.com>
Mon, 5 Jun 2006 01:09:46 +0000 (01:09 +0000)
committerHye-Shik Chang <hyeshik@gmail.com>
Mon, 5 Jun 2006 01:09:46 +0000 (01:09 +0000)
CJKCodecs' shift-jis decoder.

Misc/NEWS
Modules/cjkcodecs/_codecs_jp.c

index e9b9b114c29f20f2398233ade217a41479df7500..3171e036593fc4709e1d5eb2ede6d35417d63d3d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -17,6 +17,8 @@ Core and builtins
 Extension Modules
 -----------------
 
+- Fixed a potentially invalid memory access of CJKCodecs' shift-jis decoder.
+
 - Calling Tk_Init twice is refused if the first call failed as that
   may deadlock.
 
index 860a979f87d830fb798aa064d7503086dcd92a18..72b4db0b23417f545471007b006e26ff2637104e 100644 (file)
@@ -640,10 +640,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;