-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix ASAN warning caused by global initialization order using CryptoPP functions #1747
Conversation
This changes completely with #1729 |
Probably in upgrade_v12_to_v13 it could be local variable copy? |
@cryptocode I think it still needs to go in as we want this in v18 @SergiySW Good idea, and done. I've removed the circular_buffer changes to make the diff more concise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wezrule yeah, comment made before milestoning. LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
… functions (#1747) * Fix ASAN warning by doing lazy initialization * Make a local reference and remove unrelated circular buffer changes * Remove other unrelated change
Fixes ASAN warning Mac/Clang:
This is because our
ledger_constants globals
variable is initialized with globals from CryptoPP which haven't been properly initialized yet. There is not specified order of global initialization within different translation units. The problem specifically comes from:random_pool.GenerateBlock (not_an_account.bytes.data (), not_an_account.bytes.size ());
in theledger_constants
constructor. This ultimately uses a default argument ofconst NameValuePairs ¶ms = g_nullNameValuePairs
butg_nullNameValuePairs
has not been initialized yet.I have modified it to use lazy initialization when the nano::not_an_account is used and made it thread safe as well.
not_a_block is not used so has been removed