From: Hye-Shik Chang Date: Mon, 5 Jun 2006 01:09:46 +0000 (+0000) Subject: (Backport from trunk) Fix a potentially invalid memory access of X-Git-Tag: v2.4.4c1~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04d547e397b9bccb40958dd7643b2aef1c8e9063;p=thirdparty%2FPython%2Fcpython.git (Backport from trunk) Fix a potentially invalid memory access of CJKCodecs' shift-jis decoder. --- diff --git a/Misc/NEWS b/Misc/NEWS index e9b9b114c29f..3171e036593f 100644 --- 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. diff --git a/Modules/cjkcodecs/_codecs_jp.c b/Modules/cjkcodecs/_codecs_jp.c index 860a979f87d8..72b4db0b2341 100644 --- a/Modules/cjkcodecs/_codecs_jp.c +++ b/Modules/cjkcodecs/_codecs_jp.c @@ -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;