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 UBSan issue #1615

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix UBSan issue #1615

wants to merge 2 commits into from

Conversation

dnmokhov
Copy link
Contributor

Description

UBSan reports an error if we try to downcast a misaligned address. To avoid it, we need to check if an address is valid before casting it.

Here is the UBSan error:

concurrent_hash_map.h:470:62: runtime error: downcast of misaligned address 0x000000000003 for type 'node' (aka 'tbb::detail::d2::concurrent_hash_map<int, int>::node'), which requires 8 byte alignment
0x000000000003: note: pointer points here
<memory cannot be printed>
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior concurrent_hash_map.h:470:62

Fixes #1601

Type of change

  • bug fix - change that fixes an issue
  • new feature - change that adds functionality
  • tests - change in tests
  • infrastructure - change in infrastructure and CI
  • documentation - documentation update

Tests

  • added - required for new features and some bug fixes
  • not needed

Documentation

  • updated in # - add PR number
  • needs to be updated
  • not needed

Breaks backward compatibility

  • Yes
  • No
  • Unknown

Signed-off-by: Dmitri Mokhov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clang UBSan alignment error in tbb::concurrent_hash_map::hash_map_iterator constructor
1 participant