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: asan errors on unit tests #2564

Merged
merged 4 commits into from
Feb 10, 2024
Merged

fix: asan errors on unit tests #2564

merged 4 commits into from
Feb 10, 2024

Conversation

kostasrim
Copy link
Contributor

depends on romange/helio#213 (once it's merged I will pull the latest helio here)

@kostasrim kostasrim self-assigned this Feb 8, 2024
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);
Copy link
Contributor Author

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);
Copy link
Contributor

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

@kostasrim kostasrim merged commit 795d000 into main Feb 10, 2024
10 checks passed
@kostasrim kostasrim deleted the fix_asan_errors branch February 10, 2024 17:48
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.

None yet

2 participants