Skip to content

Comments

warning: null format string in stop.c#612

Open
astamm wants to merge 1 commit intostevengj:masterfrom
astamm:null-format-string
Open

warning: null format string in stop.c#612
astamm wants to merge 1 commit intostevengj:masterfrom
astamm:null-format-string

Conversation

@astamm
Copy link

@astamm astamm commented Apr 23, 2025

gcc-ubsan and gcc-asan show

warning: null format string

occurring in stop.c specifically in function nlopt_vsprintf().

According to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116834, the fix is to first check that the pointer to format is not null and abort if it is before calling vsnprintf().

@stevengj
Copy link
Owner

Where is it being called with a NULL format string? I'm more worried about the call site.

@astamm
Copy link
Author

astamm commented Apr 23, 2025

It actually happens at build time of nlopt with gcc-asan, prior to using its functions in nloptr. Three other warnings seem to be raised as well: see full details in 00install.out.txt.

@aitap
Copy link
Contributor

aitap commented Apr 28, 2025

When sanitizers are enabled with GCC, many "middle-end" warnings are unreliable and known to produce false positives (e.g. 1 2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants