Skip to content

Conversation

@chfast
Copy link
Member

@chfast chfast commented Jul 24, 2024

In EOF validation tests, move the container to new heap-allocated buffer of exact size to easily find out-of-buffer reads with address sanitizer.

In EOF validation tests, move the container to new heap-allocated buffer
of exact size to easily find out-of-buffer reads with address sanitizer.
@chfast chfast requested review from gumb0 and pdobacz July 24, 2024 10:19
@codecov
Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.30%. Comparing base (26d5609) to head (6a792b3).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #958   +/-   ##
=======================================
  Coverage   94.29%   94.30%           
=======================================
  Files         143      143           
  Lines       16138    16142    +4     
=======================================
+ Hits        15218    15222    +4     
  Misses        920      920           
Flag Coverage Δ
eof_execution_spec_tests 16.93% <0.00%> (-0.01%) ⬇️
ethereum_tests 26.90% <0.00%> (-0.01%) ⬇️
ethereum_tests_silkpre 18.68% <0.00%> (-0.01%) ⬇️
execution_spec_tests 17.90% <0.00%> (-0.01%) ⬇️
unittests 89.73% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
test/unittests/eof_validation.cpp 93.22% <100.00%> (+0.23%) ⬆️

@chfast chfast merged commit 6a792b3 into master Jul 24, 2024
@chfast chfast deleted the tests/eof_outofbuffer_help branch July 24, 2024 10:46
Copy link
Member

@pdobacz pdobacz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

const auto& test_case = test_cases[i];
EXPECT_EQ(evmone::validate_eof(rev, test_case.kind, test_case.container), test_case.error)

// Move the container to new heap-allocated buffer of exact size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't test_case.container.shrink_to_fit() achieve the same?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for std::string where there is SSO and additional NULL terminator.

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.

4 participants