-
Notifications
You must be signed in to change notification settings - Fork 5.1k
quiche: fix SpdyStringUtilsTest ASAN failure and disable quic_mem_slice_storage_test #10268
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
Conversation
Signed-off-by: Dan Zhang <danzh@google.com>
/assign @mattklein123 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Oops can you fix format? /wait |
Signed-off-by: Dan Zhang <danzh@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -89,7 +89,9 @@ bool HexDecodeToUInt32(absl::string_view data, uint32_t* out) { | |||
std::string byte_string = absl::HexStringToBytes(data_padded); | |||
|
|||
ASSERT(byte_string.size() == 4u); | |||
*out = ntohl(*reinterpret_cast<const uint32_t*>(byte_string.c_str())); | |||
uint32_t bytes; | |||
memcpy(&bytes, byte_string.data(), byte_string.length()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per discussions about memcpy issues can you change the above ASSERT to a RELEASE_ASSERT, or, use std::min(byte_string.length(), sizeof(bytes) as the 3rd arg for memcpy.
That way this will be obviously correct at a glance without worrying about what HexStringToBytes might return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or you can use MemBlockBuiilder in source/common/common/mem_block_builder.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@@ -88,8 +88,10 @@ bool HexDecodeToUInt32(absl::string_view data, uint32_t* out) { | |||
|
|||
std::string byte_string = absl::HexStringToBytes(data_padded); | |||
|
|||
ASSERT(byte_string.size() == 4u); | |||
*out = ntohl(*reinterpret_cast<const uint32_t*>(byte_string.c_str())); | |||
RELEASE_ASSERT(byte_string.size() == 4u, "padded dtat is not 4 byte long."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/dtat/data
Can you fix this in your next change? If this passes I would like to unwedge CI. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
Coverage is now failing with
Which I think is from a recent @mkbehr PR. I'm going to force merge so we can make progress on fixing coverage. |
Oops! Sent out #10279 to fix coverage. |
Signed-off-by: Dan Zhang danzh@google.com
Exclude the test from the test suit because it breaks coverage test. Will add it back once fixed.
Fix an asan failure in HexDecodeToUInt32():
ource/extensions/quic_listeners/quiche/platform/string_utils.cc:92:16: runtime error: load of misaligned address 0x7ffed8abe381 for type 'const uint32_t' (aka 'const unsigned int'), which requires 4 byte alignment