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

GCC overflow warnings (format-overflow, stringop-overflow) #85124

Open
tiran opened this issue Jun 12, 2020 · 3 comments
Open

GCC overflow warnings (format-overflow, stringop-overflow) #85124

tiran opened this issue Jun 12, 2020 · 3 comments
Labels
3.13 bugs and security fixes build The build process and cross-build

Comments

@tiran
Copy link
Member

tiran commented Jun 12, 2020

BPO 40952
Nosy @ncoghlan, @tiran

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 = None
created_at = <Date 2020-06-12.07:14:45.817>
labels = ['build', '3.9', '3.10']
title = 'GCC overflow warnings (format-overflow, stringop-overflow)'
updated_at = <Date 2020-11-07.05:56:33.375>
user = 'https://github.com/tiran'

bugs.python.org fields:

activity = <Date 2020-11-07.05:56:33.375>
actor = 'ncoghlan'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Build']
creation = <Date 2020-06-12.07:14:45.817>
creator = 'christian.heimes'
dependencies = []
files = []
hgrepos = []
issue_num = 40952
keywords = []
message_count = 2.0
messages = ['371335', '380493']
nosy_count = 2.0
nosy_names = ['ncoghlan', 'christian.heimes']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'compile error'
url = 'https://bugs.python.org/issue40952'
versions = ['Python 3.9', 'Python 3.10']

@tiran
Copy link
Member Author

tiran commented Jun 12, 2020

I'm getting a couple of compiler warnings with gcc-10.1.1 (Fedora 32) with an asan and ubsan build:

Parser/string_parser.c: In function ‘decode_unicode_with_escapes’:
Parser/string_parser.c:100:17: warning: null destination pointer [-Wformat-overflow=]
100 | sprintf(p, "\\U%08x", chr);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
Parser/string_parser.c:100:17: warning: null destination pointer [-Wformat-overflow=]
Parser/string_parser.c:100:17: warning: null destination pointer [-Wformat-overflow=]

Objects/unicodeobject.c: In function ‘xmlcharrefreplace’:
Objects/unicodeobject.c:849:16: warning: null destination pointer [-Wformat-overflow=]
849 | str += sprintf(str, "&#%d;", PyUnicode_READ(kind, data, i));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Objects/unicodeobject.c:849:16: warning: null destination pointer [-Wformat-overflow=]
Objects/unicodeobject.c:849:16: warning: null destination pointer [-Wformat-overflow=]

In function ‘assemble_lnotab’,
inlined from ‘assemble_emit’ at Python/compile.c:5697:25,
inlined from ‘assemble’ at Python/compile.c:6036:18:
Python/compile.c:5651:19: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
5651 | *lnotab++ = k;
| ~~~~~~~~~~^~~

@tiran tiran added 3.9 only security fixes 3.10 only security fixes build The build process and cross-build labels Jun 12, 2020
@ncoghlan
Copy link
Contributor

ncoghlan commented Nov 7, 2020

I *think* the lnotab one is the compiler failing to detect that the pointer has been updated to point inside the body of a Python object, but I'm also not 100% sure that it's a false alarm.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@skirpichev
Copy link
Member

Another case for stringop-overflow on GCC 12.2.0 (Debian Bookworm): #108562 (EXTRACT_DIGIT macro expansion). Haven't seen them on GCC 10.2.x (Debian oldstable).

@erlend-aasland erlend-aasland added 3.13 bugs and security fixes and removed 3.10 only security fixes 3.9 only security fixes labels Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes build The build process and cross-build
Projects
None yet
Development

No branches or pull requests

4 participants