classification
Title: DoS when lo is negative in bisect.insort_right() / _left()
Type: crash Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: georg.brandl, rhettinger, vstinner
Priority: high Keywords: patch

Created on 2008-07-06 15:12 by vstinner, last changed 2008-07-10 14:03 by rhettinger. This issue is now closed.

Files
File name Uploaded Description Edit
bisect_lo.patch vstinner, 2008-07-06 15:12 Patch workaround the bisect lo bug
Messages (4)
msg69334 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-07-06 15:12
"import bisect; bisect.insort(range(4), -1, -1)" goes into an 
unlimited loop.  Workaround: replace negative lo value by zero. The 
function may raise an exception.
msg69340 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-07-06 17:01
The same is true for all other _bisect functions.

The pure Python versions from bisect work with negative indices by
interpreting them as in slice notation. This should probably be harmonized.
msg69344 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-07-06 17:24
Don't think negative indices make much sense in this context.  Will put 
in a test to raise a ValueError for negative indices.
msg69502 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-07-10 14:03
Fixed in 64845.
History
Date User Action Args
2008-07-10 14:03:52rhettingersetstatus: open -> closed
resolution: fixed
messages: + msg69502
2008-07-06 17:24:32rhettingersetpriority: high
messages: + msg69344
2008-07-06 17:01:19georg.brandlsetassignee: rhettinger
messages: + msg69340
nosy: + rhettinger, georg.brandl
2008-07-06 15:12:21vstinnercreate