From 58ce5bc14c514a3d7ddc06a4b57d2101104cd8aa Mon Sep 17 00:00:00 2001 From: Hye-Shik Chang Date: Mon, 5 Jun 2006 00:59:54 +0000 Subject: Fix a potentially invalid memory access of CJKCodecs' shift-jis decoder. (found by Neal Norwitz) --- Misc/NEWS | 2 ++ Modules/cjkcodecs/_codecs_jp.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index 6f5a90e..f5a225f 100644 --- 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 diff --git a/Modules/cjkcodecs/_codecs_jp.c b/Modules/cjkcodecs/_codecs_jp.c index 9b8d324..f49a10b 100644 --- a/Modules/cjkcodecs/_codecs_jp.c +++ b/Modules/cjkcodecs/_codecs_jp.c @@ -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; -- cgit v0.12