[issue35194] A typo in a constant in cp932 codec

2019-03-29 Thread Inada Naoki
Inada Naoki added the comment: New changeset 5f45979b63300338b68709bfe817ddae563b93fd by Inada Naoki (Alexey Izbyshev) in branch 'master': bpo-35194: cjkcodec: check the encoded value is not truncated (GH-10432) https://github.com/python/cpython/commit/5f45979b63300338b68709bfe817ddae563b93fd

[issue35194] A typo in a constant in cp932 codec

2019-03-29 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ P

[issue35194] A typo in a constant in cp932 codec

2018-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 0d165262d949440e5aea6533b10e19e4cd5cf12d by Serhiy Storchaka (Alexey Izbyshev) in branch '2.7': [2.7] bpo-35194: Fix a wrong constant in cp932 codec. (GH-10420) (GH-10433) https://github.com/python/cpython/commit/0d165262d949440e5aea6533b10e19

[issue35194] A typo in a constant in cp932 codec

2018-11-09 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: OUTCHAR2 is a wrong example. Other examples are NEXT_IN, NEXT_OUT. -- ___ Python tracker ___ ___

[issue35194] A typo in a constant in cp932 codec

2018-11-09 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: I've checked than other macros in Modules/cjkcodecs/cjkcodecs.h don't avoid multiple argument evaluation (e.g. OUTCHAR2, _TRYMAP_ENC), so I've changed 'assert' to a variant of what Serhiy suggested. -- ___ Python

[issue35194] A typo in a constant in cp932 codec

2018-11-09 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- pull_requests: +9707 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue35194] A typo in a constant in cp932 codec

2018-11-09 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: > Maybe test "Py_CHARMASK(c) == (c)"? This is a good alternative if multiple evaluation of 'c' is acceptable. Though I'd prefer '(unsigned char)c == c' for this style of fixing because it is bit closer to what happens in '((*outbuf)[i]) = c'. -- _

[issue35194] A typo in a constant in cp932 codec

2018-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Converting to unsigned int can unnecessary widen the value or truncate higher bits. On other side, testing "0 <= (c)" can emit a compiler warning if c is unsigned. Maybe test "Py_CHARMASK(c) == (c)"? -- ___ Pyt

[issue35194] A typo in a constant in cp932 codec

2018-11-09 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: I've added 'assert' to macros. Since 'typeof' seems to be disallowed in Python, I've used 'unsigned int' as the type of an intermediate variable. Another alternative is 'assert(0 <= (c) && (c) <= 255)', but 'c' will be evaluated several times. --

[issue35194] A typo in a constant in cp932 codec

2018-11-09 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- pull_requests: +9706 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue35194] A typo in a constant in cp932 codec

2018-11-09 Thread STINNER Victor
STINNER Victor added the comment: > Maybe add asserts in OUTBYTE1() and similar macros to prevent similar errors > in future? I like the idea. Make sure that: 0 <= ch <= 255? -- ___ Python tracker

[issue35194] A typo in a constant in cp932 codec

2018-11-08 Thread miss-islington
miss-islington added the comment: New changeset 22234f1375d28803074405497ea61315fb37240d by Miss Islington (bot) in branch '3.7': bpo-35194: Fix a wrong constant in cp932 codec (GH-10420) https://github.com/python/cpython/commit/22234f1375d28803074405497ea61315fb37240d -- _

[issue35194] A typo in a constant in cp932 codec

2018-11-08 Thread miss-islington
miss-islington added the comment: New changeset 49ee41f1c3934aa095e32fa751cdf3ba641ae34b by Miss Islington (bot) in branch '3.6': bpo-35194: Fix a wrong constant in cp932 codec (GH-10420) https://github.com/python/cpython/commit/49ee41f1c3934aa095e32fa751cdf3ba641ae34b -- _

[issue35194] A typo in a constant in cp932 codec

2018-11-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Maybe add asserts in OUTBYTE1() and similar macros to prevent similar errors in future? -- versions: +Python 2.7, Python 3.6, Python 3.7 ___ Python tracker __

[issue35194] A typo in a constant in cp932 codec

2018-11-08 Thread miss-islington
Change by miss-islington : -- pull_requests: +9705 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue35194] A typo in a constant in cp932 codec

2018-11-08 Thread miss-islington
Change by miss-islington : -- pull_requests: +9704 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue35194] A typo in a constant in cp932 codec

2018-11-08 Thread miss-islington
miss-islington added the comment: New changeset 7a69cf47a9bbc95f95fd67c982bff121b2a903cb by Miss Islington (bot) (Alexey Izbyshev) in branch 'master': bpo-35194: Fix a wrong constant in cp932 codec (GH-10420) https://github.com/python/cpython/commit/7a69cf47a9bbc95f95fd67c982bff121b2a903cb

[issue35194] A typo in a constant in cp932 codec

2018-11-08 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +9700 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-

[issue35194] A typo in a constant in cp932 codec

2018-11-08 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : UBSan with -fsanitize=implicit-integer-truncation found a suspicious one: /scratch2/izbyshev/cpython/Modules/cjkcodecs/_codecs_jp.c:43:17: runtime error: implicit conversion from type 'unsigned int' of value 4294966013 (32-bit, unsigned) to type 'unsigned