-
Notifications
You must be signed in to change notification settings - Fork 876
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: asan errors on unit tests #2564
Conversation
memcpy(next, slices[0].data(), slices[0].size()); | ||
next += slices[0].size(); | ||
memcpy(next, slices[1].data(), slices[1].size()); | ||
detail::ascii_unpack_simd(reinterpret_cast<uint8_t*>(dest + space_left), decoded_len, dest); | ||
detail::ascii_unpack_simd(reinterpret_cast<uint8_t*>(tmp.data()), decoded_len, dest); |
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.
I need to check in other places as well. The problem is that we overshoot the buffer. We read starting from dest + space_left
and we simd load 16 bytes. On the second iteration we increment dest by 14, which causes the starting address to be at pos 18 (because space_left == 4) and we read another 16 bytes overshooting the 32 available bytes
VarintBuffer ranged_source{0}; | ||
memcpy(&ranged_source, source.data(), source.size()); | ||
absl::Span<const uint8_t> source2 = absl::MakeSpan(ranged_source); | ||
read = base::flit::ParseT(source2.data(), &out); |
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.
Good catch, it's actually written in the flit comments. You don't need a span to get a pointer, you can pass directly
depends on romange/helio#213 (once it's merged I will pull the latest helio here)