Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.3k
Possible UB in bytes_characters #106693
Copy link
Copy link
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsTodo
in
bytes_charactersin https://github.com/python/cpython/blob/main/Include/internal/pycore_runtime_init.h we are doing this:where
with
but
cpython/Include/internal/pycore_global_objects.h
Lines 41 to 44 in e4b88c1
and
cpython/Include/cpython/bytesobject.h
Lines 5 to 15 in e4b88c1
I think this is UB because when we are basically assigning 255 to:
https://github.com/python/cpython/blob/e4b88c1e4ac129b36f99a534387d64f7b8cda8ef/Include/cpython/bytesobject.h#L8C10-L8C17
and that should be a
unsigned charbecause the range ofcharcan be 0 to 255 or -128 to 127 depending on the platform.Linked PRs