Skip to content

warning: null format string in stop.c #612

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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