]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[2.7] bpo-35194: Fix a wrong constant in cp932 codec. (GH-10420) (GH-10433)
authorAlexey Izbyshev <izbyshev@ispras.ru>
Sat, 10 Nov 2018 05:47:12 +0000 (08:47 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sat, 10 Nov 2018 05:47:12 +0000 (07:47 +0200)
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.
(cherry picked from commit 7a69cf47a9bbc95f95fd67c982bff121b2a903cb)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
Modules/cjkcodecs/_codecs_jp.c

index a05e01b32e5a41281ea1e87379d4e406f82fd588..3acd19e6258ebf1b58f7f58f1ad05465cee54153 100644 (file)
@@ -40,7 +40,7 @@ ENCODER(cp932)
             if (c == 0xf8f0)
                 OUT1(0xa0)
             else
-                OUT1(c - 0xfef1 + 0xfd)
+                OUT1(c - 0xf8f1 + 0xfd)
             NEXT(1, 1)
             continue;
         }