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

Add STBSP__ASAN for msvc compiler #1477

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

Conversation

septag
Copy link

@septag septag commented May 16, 2023

No description provided.

@Condzi
Copy link

Condzi commented Feb 1, 2024

I also had an issue with ASAN and the trick stbsp uses for finding '\0'. However, I found out that I also need to modify STBSP_PUBLICDEC / PUBLICDEF macros by adding STBSP__ASAN to them, like so:

#ifdef STB_SPRINTF_STATIC
#define STBSP__PUBLICDEC static STBSP__ASAN
#define STBSP__PUBLICDEF static STBSP__ASAN
#else
#ifdef __cplusplus
#define STBSP__PUBLICDEC extern "C" STBSP__ASAN
#define STBSP__PUBLICDEF extern "C" STBSP__ASAN
#else
#define STBSP__PUBLICDEC extern STBSP__ASAN
#define STBSP__PUBLICDEF STBSP__ASAN
#endif
#endif

I'm not sure why they aren't there in the first place. Without this added, my code still was giving me global-buffer-overflow.

@Manuzor
Copy link

Manuzor commented Feb 18, 2024

I came here because I ran into global-buffer-overflow as well, even with the fixes in this PR, but the final missing piece was adding STBSP__ASAN to the public definitions, so thanks @Condzi for that info!

By the way, I think this PR is a duplicate of #1350 although it contains an explicit MSVC version check.

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.

None yet

3 participants