Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DoS when lo is negative in bisect.insort_right() / _left() #47551

Closed
vstinner opened this issue Jul 6, 2008 · 4 comments
Closed

DoS when lo is negative in bisect.insort_right() / _left() #47551

vstinner opened this issue Jul 6, 2008 · 4 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@vstinner
Copy link
Member

vstinner commented Jul 6, 2008

BPO 3301
Nosy @birkenfeld, @rhettinger, @vstinner
Files
  • bisect_lo.patch: Patch workaround the bisect lo bug
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/rhettinger'
    closed_at = <Date 2008-07-10.14:03:52.583>
    created_at = <Date 2008-07-06.15:12:21.049>
    labels = ['library', 'type-crash']
    title = 'DoS when lo is negative in bisect.insort_right() / _left()'
    updated_at = <Date 2008-07-10.14:03:52.582>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2008-07-10.14:03:52.582>
    actor = 'rhettinger'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2008-07-10.14:03:52.583>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2008-07-06.15:12:21.049>
    creator = 'vstinner'
    dependencies = []
    files = ['10830']
    hgrepos = []
    issue_num = 3301
    keywords = ['patch']
    message_count = 4.0
    messages = ['69334', '69340', '69344', '69502']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'rhettinger', 'vstinner']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue3301'
    versions = ['Python 2.6']

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 6, 2008

    "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.

    @vstinner vstinner added stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump labels Jul 6, 2008
    @birkenfeld
    Copy link
    Member

    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.

    @rhettinger
    Copy link
    Contributor

    Don't think negative indices make much sense in this context. Will put
    in a test to raise a ValueError for negative indices.

    @rhettinger
    Copy link
    Contributor

    Fixed in 64845.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants