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

Make silent the overflow report for uint256_t hash calculator (UBSan report) #3658

Open
thsfs opened this issue Jan 7, 2022 · 0 comments
Open

Comments

@thsfs
Copy link
Contributor

thsfs commented Jan 7, 2022

Got an UBSan error report from Address Sanitizer when running it upon core_test.

/ws/nano-node/nano/lib/numbers.hpp:278:46: runtime error: unsigned integer overflow: 18363490017020192492 + 15047902047331995846 cannot be represented in type 'unsigned long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /ws/nano-node/nano/lib/numbers.hpp:278:46 in 

The overflow is expected as part of the hash calculation, but this should ideally not trigger an error.

Code portion from which the complain comes from:

template <>
struct hash<::nano::uint256_union>
{
	size_t operator() (::nano::uint256_union const & data_a) const
	{
		return data_a.qwords[0] + data_a.qwords[1] + data_a.qwords[2] + data_a.qwords[3];
	}
};

OS: Ubuntu 20.04

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

No branches or pull requests

2 participants