DmitryJ added the comment:

Quick analysis tells this can be attributed to the following code (in 2.7):

https://hg.python.org/cpython/file/a8e24d776e99/Objects/stringlib/fastsearch.h#l110
https://hg.python.org/cpython/file/a8e24d776e99/Objects/stringlib/fastsearch.h#l116

Suppose i = 0, then s[i+m] causes OOB access when m=n. Note only one iteration 
is possible in case of m=n due to loop condition of i <= (w = n-m = 0). 
Theoretically, one can try disclosing one adjacent byte, but more likely 
results are nothing (or potentially invalid match result) or a potential crash 
in an unlucky case of s[m] hitting an unmapped page.

The same code lives in 3.2 (and likely any prior 3.x release), and 3.3 seems to 
be affected as well. 3.4 code has a modified version, but has the same problem 
(ss = s + m - 1; if (!STRINGLIB_BLOOM(mask, ss[i+1])) ...).

----------
nosy: +dev_zzo

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24462>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to