From 506ef7c1e89b6d61f60d5b2995394a3584555c7f Mon Sep 17 00:00:00 2001 From: Alexey Izbyshev Date: Fri, 9 Nov 2018 01:38:04 +0300 Subject: [PATCH] bpo-35194: Fix a wrong constant in cp932 codec This typo doesn't affect the result because wrong bits are discarded on implicit conversion to unsigned char, but it trips UBSan with -fsanitize=implicit-integer-truncation. --- Modules/cjkcodecs/_codecs_jp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/cjkcodecs/_codecs_jp.c b/Modules/cjkcodecs/_codecs_jp.c index 2c7788a645813c..3a332953b957cb 100644 --- a/Modules/cjkcodecs/_codecs_jp.c +++ b/Modules/cjkcodecs/_codecs_jp.c @@ -40,7 +40,7 @@ ENCODER(cp932) if (c == 0xf8f0) OUTBYTE1(0xa0); else - OUTBYTE1(c - 0xfef1 + 0xfd); + OUTBYTE1(c - 0xf8f1 + 0xfd); NEXT(1, 1); continue; }