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

Assertion failures when calling PyNumber_ToBase() with an invalid base #82824

Closed
ZackerySpytz mannequin opened this issue Oct 30, 2019 · 6 comments
Closed

Assertion failures when calling PyNumber_ToBase() with an invalid base #82824

ZackerySpytz mannequin opened this issue Oct 30, 2019 · 6 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-C-API type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@ZackerySpytz
Copy link
Mannequin

ZackerySpytz mannequin commented Oct 30, 2019

BPO 38643
Nosy @serhiy-storchaka, @ZackerySpytz
PRs
  • bpo-38643: Assertion failures when calling PyNumber_ToBase() with an invalid base #16996
  • bpo-38643: Raise SystemError instead of crashing when PyNumber_ToBase is called with invalid base. #18863
  • [3.8] bpo-38643: Raise SystemError instead of crashing when PyNumber_ToBase is called with invalid base. (GH-18863). #18954
  • [3.7] bpo-38643: Raise SystemError instead of crashing when PyNumber_ToBase is called with invalid base. (GH-18863). #18955
  • 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 = None
    closed_at = <Date 2020-03-12.08:18:44.688>
    created_at = <Date 2019-10-30.14:20:36.387>
    labels = ['expert-C-API', '3.7', '3.8', '3.9', 'type-crash']
    title = 'Assertion failures when calling PyNumber_ToBase() with an invalid base'
    updated_at = <Date 2020-03-12.08:18:44.687>
    user = 'https://github.com/ZackerySpytz'

    bugs.python.org fields:

    activity = <Date 2020-03-12.08:18:44.687>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-03-12.08:18:44.688>
    closer = 'serhiy.storchaka'
    components = ['C API']
    creation = <Date 2019-10-30.14:20:36.387>
    creator = 'ZackerySpytz'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38643
    keywords = ['patch']
    message_count = 6.0
    messages = ['355715', '363686', '363758', '363994', '363999', '364002']
    nosy_count = 2.0
    nosy_names = ['serhiy.storchaka', 'ZackerySpytz']
    pr_nums = ['16996', '18863', '18954', '18955']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue38643'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @ZackerySpytz
    Copy link
    Mannequin Author

    ZackerySpytz mannequin commented Oct 30, 2019

    If a base other than 2, 8, or 16 is passed to PyNumber_ToBase(), an assertion failure will occur. An exception should be raised instead.

    This was mentioned in bpo-38249 (msg353039).

    @ZackerySpytz ZackerySpytz mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes type-crash A hard crash of the interpreter, possibly with a core dump labels Oct 30, 2019
    @serhiy-storchaka
    Copy link
    Member

    Sorry Zackery, I did not know about this issue so I wrote different PR to fix this problem. And only after writing it I have found this issue.

    There are several differences between your PR and PR 18863.

    • SystemError is raised instead of ValueError because this is incorrect use of the C API.
    • The error message mentions also base 10.
    • The test is written mostly in Python.

    For these reasons I prefer my PR.

    Please let me know if you need a review for other PRs.

    @serhiy-storchaka serhiy-storchaka added topic-C-API and removed interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Mar 8, 2020
    @serhiy-storchaka
    Copy link
    Member

    New changeset e5ccc94 by Serhiy Storchaka in branch 'master':
    bpo-38643: Raise SystemError instead of crashing when PyNumber_ToBase is called with invalid base. (GH-18863)
    e5ccc94

    @ZackerySpytz
    Copy link
    Mannequin Author

    ZackerySpytz mannequin commented Mar 12, 2020

    Okay, Serhiy. I think your patch is a better choice.

    @serhiy-storchaka
    Copy link
    Member

    New changeset ab9c729 by Serhiy Storchaka in branch '3.8':
    [3.8] bpo-38643: Raise SystemError instead of crashing when PyNumber_ToBase is called with invalid base. (GH-18863). (GH-18954)
    ab9c729

    @serhiy-storchaka
    Copy link
    Member

    New changeset 6f4e7fc by Serhiy Storchaka in branch '3.7':
    [3.7] bpo-38643: Raise SystemError instead of crashing when PyNumber_ToBase is called with invalid base. (GH-18863). (GH-18955)
    6f4e7fc

    @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
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-C-API type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant