Repository navigation
Reclaim one byte from HeaderString. - #6826
Merged
mattklein123 merged 2 commits intoMay 7, 2019
Merged
Conversation
mattklein123
requested changes
May 6, 2019
mattklein123
left a comment
Member
There was a problem hiding this comment.
Nice thanks for doing all of these follow ups. I assume you audited all calls to make sure we aren't using data() anywhere in the existing code? I know we caught some last time.
/wait
With conversion to getStringView() access there is no longer any need to reserve a NUL byte at the end of the HeaderString since all accesses will be through string_views which are not required to be NUL terminated. Ran bazel test -c opt //test/... --config=asan --runs_per_test=10 without issue. There is some risk that someone has or will abuse the data() accessor on a string_view assuming it is NUL terminated. A comment is added to emphasize that the HeaderString::getStringView() is not NUL terminated. By eliminating this wasted byte it is more likely that a HeaderString will fit into the existing embedded space, hopefully giving a small performance gain and reduction in memory allocations. Signed-off-by: Dan Noé <[email protected]>
Signed-off-by: Dan Noé <[email protected]>
dnoe
force-pushed
the
remove-headerstring-space-for-nul
branch
from
May 7, 2019 16:33
14cb6ca to
16c6604
Compare
Contributor
Author
|
Sorry about the force push, somehow I screwed up my local branch trying to be smart. It should be the same two commits, so you can see the changes by looking at the second commit. |
Contributor
Author
|
Manual inspection finds no mis-use of |
htuch
added a commit
to htuch/envoy
that referenced
this pull request
May 8, 2019
This is failing header_map_impl_fuzz due to memcpy heap buffer overflow and should be considered a serious security issue. Given this was only introduced in the last day and does not affect any release, a revert and bump is the consensus of Envoy security team. This reverts commit 977907d. Fixes oss-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14639. Risk level: Low Testing: Corpus entry added, bazel test //test/common/http:header_map_impl_fuzz_test --test_output=all -c dbg --config=clang-asan Signed-off-by: Harvey Tuch <[email protected]>
htuch
added a commit
that referenced
this pull request
May 9, 2019
This is failing header_map_impl_fuzz due to memcpy heap buffer overflow and should be considered a serious security issue. Given this was only introduced in the last day and does not affect any release, a revert and bump is the consensus of Envoy security team. This reverts commit 977907d. Fixes oss-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14639. Risk level: Low Testing: Corpus entry added, bazel test //test/common/http:header_map_impl_fuzz_test --test_output=all -c dbg --config=clang-asan Signed-off-by: Harvey Tuch <[email protected]>
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.
Description:
With conversion to
getStringView()access there is no longer any need toreserve a NUL byte at the end of the HeaderString since all accesses
will be through string_views which are not required to be NUL
terminated.
Ran
bazel test -c opt //test/... --config=asan --runs_per_test=10without issue. There is some risk that someone has or will abuse the
data() accessor on a string_view assuming it is NUL terminated. A
comment is added to emphasize that the
HeaderString::getStringView()isnot NUL terminated.
By eliminating this wasted byte it is more likely that a HeaderString
will fit into the existing embedded space, hopefully giving a small
performance gain and reduction in memory allocations.
Signed-off-by: Dan Noé [email protected]
Risk Level: Medium
Testing:
bazel test -c opt //test/... --config=asan --runs_per_test=10Docs Changes: None
Release Notes: None
Part of: Issue #6580