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

Fix BOOST_REQUIRE false positives #7341

Merged

Conversation

andreaslutsch
Copy link
Contributor

@andreaslutsch andreaslutsch commented Feb 28, 2025

The BOOST_REQUIRE macros would not exit early and in case of a possible null pointer assignment in the condition, it would not get caught in the macro definition.
This would show false positives in next usages of the condition and show a nullPointerOutOfMemory warning, whereas the BOOST_REQUIRE would have thrown an exception.

Mimic BOOST_REQUIRE behavior in the macro.

Added a test for this, also the warning would not show when using std::malloc, but does show up when using malloc.

@andreaslutsch andreaslutsch changed the title Fix boost require false positives Fix BOOST_REQUIRE false positives Feb 28, 2025
The REQUIRE macros would not exit early and in case a null pointer would be in the condition it would not get caught and this would show false positives in next usages of the condition and show a nullPointerOutOfMemory warning.
@andreaslutsch andreaslutsch force-pushed the fix_boost_require_false_positives branch from 1b7c722 to 2a227df Compare February 28, 2025 13:08
@chrchr-github
Copy link
Collaborator

Thanks for your contribution. How would you like to be credited as an author?

@andreaslutsch
Copy link
Contributor Author

Thanks for your contribution. How would you like to be credited as an author?

Hi, I guess just my name would be fine as Andreas Lutsch.

@chrchr-github chrchr-github merged commit 5b1921e into danmar:main Mar 1, 2025
60 checks passed
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.

2 participants