Prevent undefined behavior in QUICHE logging#15635
Merged
alyssawilk merged 4 commits intoenvoyproxy:mainfrom Mar 31, 2021
Merged
Prevent undefined behavior in QUICHE logging#15635alyssawilk merged 4 commits intoenvoyproxy:mainfrom
alyssawilk merged 4 commits intoenvoyproxy:mainfrom
Conversation
This change adds a NullGuard which will prevent us from sending null strings to output streams to avoid undefined behavior. Signed-off-by: David Schinazi <dschinazi@google.com>
Contributor
|
Looks like the gcc failure might be real - mind checking out CI? |
This commit works around this bug in GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282 Signed-off-by: David Schinazi <dschinazi@google.com>
jmarantz
reviewed
Mar 25, 2021
Contributor
jmarantz
left a comment
There was a problem hiding this comment.
Code looks good; hoping for more testing of it.
| EXPECT_DEBUG_DEATH({ QUICHE_DCHECK_NE(1 + 1, 2); }, | ||
| "CHECK failed: 1 \\+ 1 \\(=2\\) != 2 \\(=2\\)"); | ||
| EXPECT_DEBUG_DEATH({ QUICHE_DCHECK_NE(nullptr, nullptr); }, | ||
| "CHECK failed: nullptr \\(=\\(null\\)\\) != nullptr \\(=\\(null\\)\\)"); |
Contributor
There was a problem hiding this comment.
I was expecting to see tests where you used quic logging macros passing in null strings and having them not crash, but instead spew out "(null)".
Contributor
There was a problem hiding this comment.
oh I think I see what's going on...you are testing we spew 'nullptr' but then to get the log at all you have to ultimately crash? Isn't there the equivalent of a LOG(ERROR) you can capture?
Contributor
Author
There was a problem hiding this comment.
Good point! I've added more testing
Signed-off-by: David Schinazi <dschinazi@google.com>
Signed-off-by: David Schinazi <dschinazi@google.com>
jmarantz
approved these changes
Mar 31, 2021
Contributor
jmarantz
left a comment
There was a problem hiding this comment.
@envoyproxy/senior-maintainers
alyssawilk
approved these changes
Mar 31, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Message:
This change adds a NullGuard which will prevent us
from sending null strings to output streams to avoid
undefined behavior.
Signed-off-by: David Schinazi dschinazi@google.com
Additional Description: None
Risk Level: Low
Testing: Local
Docs Changes: None
Release Notes: None
Platform Specific Features: None
Fixes #15620