python / cpython

The Python programming language
https://www.python.org
Other
62.46k stars 29.98k forks source link

Undefined behavior in Python/hamt.c #81627

Closed 2776f601-9573-4690-ab86-59139fdf3c89 closed 4 years ago

2776f601-9573-4690-ab86-59139fdf3c89 commented 5 years ago
BPO 37446
Nosy @benjaminp, @1st1, @ZackerySpytz, @miss-islington, @isidentical, @mangrisano
PRs
  • python/cpython#17727
  • python/cpython#17767
  • 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: ```python assignee = None closed_at = created_at = labels = ['interpreter-core', '3.8', 'type-bug', '3.7', '3.9'] title = 'Undefined behavior in Python/hamt.c' updated_at = user = 'https://github.com/ZackerySpytz' ``` bugs.python.org fields: ```python activity = actor = 'miss-islington' assignee = 'none' closed = True closed_date = closer = 'benjamin.peterson' components = ['Interpreter Core'] creation = creator = 'ZackerySpytz' dependencies = [] files = [] hgrepos = [] issue_num = 37446 keywords = ['patch'] message_count = 5.0 messages = ['346876', '346885', '358935', '359092', '359093'] nosy_count = 6.0 nosy_names = ['benjamin.peterson', 'yselivanov', 'ZackerySpytz', 'miss-islington', 'BTaskaya', 'mangrisano'] pr_nums = ['17727', '17767'] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue37446' versions = ['Python 3.7', 'Python 3.8', 'Python 3.9'] ```

    2776f601-9573-4690-ab86-59139fdf3c89 commented 5 years ago

    ./python -m unittest test.test_context.HamtTest.test_hamt_stress Python/hamt.c:1867:29: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' . ---------------------------------------------------------------------- Ran 1 test in 12.702s

    OK

    3fac99ca-ec78-4f4a-859f-25f552ac9b01 commented 5 years ago

    I don't get that output on 3.8.0a4+. I'm on OSX. Anyway, I think that 1 should be cast with unsigned.

    What do you think?

    isidentical commented 4 years ago

    I don't get that output on 3.8.0a4+

    I guess it is related with you didn't added -fsanitize=undefined option.

    benjaminp commented 4 years ago

    New changeset d0c92e81aa2171228a23cb2bed36f7dab975257d by Benjamin Peterson (Batuhan Taşkaya) in branch 'master': closes bpo-37446: resolve undefined behavior in Python/hamt.c (GH-17727) https://github.com/python/cpython/commit/d0c92e81aa2171228a23cb2bed36f7dab975257d

    miss-islington commented 4 years ago

    New changeset a278ae19b4daa1deb11e2a8eed38838027e90ece by Miss Islington (bot) in branch '3.8': closes bpo-37446: resolve undefined behavior in Python/hamt.c (GH-17727) https://github.com/python/cpython/commit/a278ae19b4daa1deb11e2a8eed38838027e90ece