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 <rep...@bugs.python.org>
<http://bugs.python.org/issue29190>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to