[New-bugs-announce] [issue29190] Avoid possible errors in comparing strings

Serhiy Storchaka report at bugs.python.org
Sat Jan 7 02:10:06 EST 2017

New submission from Serhiy Storchaka:

PyUnicode_Compare() and PyUnicode_RichCompare() can raise an exception if one of arguments is not ready unicode object. The result is not always checked for error. Proposed patch gets rid of possible bugs. PyUnicode_Compare() and PyUnicode_RichCompare() in Modules/_pickle.c are replaced with _PyUnicode_EqualToASCIIString() and _PyUnicode_EqualToASCIIId() which never fail. Additional check is added in Modules/_decimal/_decimal.c to ensure that the string which is came from a user code is ready.

All other occurrences of PyUnicode_Compare() seems are called only with ready unicode objects.

components: Extension Modules
files: unicode_compare.patch
keywords: patch
messages: 284895
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Avoid possible errors in comparing strings
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46184/unicode_compare.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list