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

[1.0.1 -> main] Verify index >= 0 in apply_diff and fix warnings #741

Merged
merged 9 commits into from
Sep 10, 2024

Conversation

linh2931
Copy link
Member

Forwards #722

index in apply_diff can be a signed int and can be negative. Currently index is only checked not greater than the size.

This also results in warnings in numerous places as apply_diff is in a header file which is included by a number of files:

libraries/libfc/include/fc/container/ordered_diff.hpp:111:35: warning: comparison of integer expressions of different signedness: ‘std::ptrdiff_t’ {aka ‘long int’} and ‘std::vector<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
...
ibraries/libfc/include/fc/container/ordered_diff.hpp:119:26: warning: comparison of integer expressions of different signedness: ‘std::tuple_element<0, std::pair<int, char> >::type’ {aka ‘int’} and ‘std::vector<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]

Resolves #723

@ericpassmore ericpassmore added bug The product is not working as was intended. and removed bug The product is not working as was intended. labels Sep 10, 2024
@ericpassmore
Copy link
Contributor

Note:start
category: Other
component: Internal
summary: Additional checks to harden the processing of the finalizer and proposer policy diffs from block header extension.
Note:end

@linh2931 linh2931 merged commit 98ea6d1 into main Sep 10, 2024
36 checks passed
@linh2931 linh2931 deleted the merge_check_negative branch September 10, 2024 21:09
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.

Stricter checks in apply_diff and compile warnings
4 participants