Author dev_zzo
Recipients JohnLeitch, dev_zzo, serhiy.storchaka
Date 2015-06-18.08:41:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
From the author's page at

"Note that the above Python code may access s[n], which would result in an IndexError exception. For the CPython implementation, this is not really a problem, since CPython adds trailing NULL entries to both 8-bit and Unicode strings."

Apparently, this flaw was known to the author, but was not documented in C code.

A possible quick-and-dirty solution is to treat m=n as a special case and resort to memcmp() or somesuch as there is no actual need to perform multiple match tries. This should fix things for bytearray and str in case str's implementation changes from appending a trailing NUL.
Date User Action Args
2015-06-18 08:41:43dev_zzosetrecipients: + dev_zzo, serhiy.storchaka, JohnLeitch
2015-06-18 08:41:43dev_zzosetmessageid: <>
2015-06-18 08:41:43dev_zzolinkissue24462 messages
2015-06-18 08:41:42dev_zzocreate