-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Avoid triggering undefined behaviour (std::memset(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...) #14242
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
Conversation
|
Shouldn't |
|
@MarcoFalke Sure! Added a commit. Please re-review :-) |
@MarcoFalke the same for -0 ae17de5 because it changes IMO should avoid the call to |
ae17de5 to
8ea1d7e
Compare
|
@MarcoFalke I think @promag has a good point. Now reverted to the original version. |
|
@promag Thanks for reviewing. Now updated. Please re-review :-) |
…defined behaviour sanitizer (UBSan) 9f49db7 Enable functional tests in UBSAN job. Enable -fsanitize=integer (part of UBSAN). Merge UBSAN Travis job with no depends. (practicalswift) Pull request description: Run functional tests and benchmarks under the undefined behaviour sanitizer (UBSan). This will make Travis automatically detect issues such as: * #14242: Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)` * #14239: Avoid dividing by zero (undefined behaviour) in `EstimateMedianVal` (policy)/`ConnectTip` (validation)/`CreateTransaction` (wallet) * #13546: wallet: Avoid potential use of uninitialized value `bnb_used` in `CWallet::CreateTransaction(...)` Addresses issue #14059. Tree-SHA512: 285e1542b36c582516c47938ce8d999fd89ba6c867bc0976e7306e7c949b8b84ffbfa43dbc679dd97ae639b086092e7d799d8e1c903c66a37d529ce61d5c64b4
|
Could remove the suppression from the file in contrib? |
8ea1d7e to
1cab4bb
Compare
|
@MarcoFalke Good point! Added commit 1cab4bb7e09c9d68e104460b67e5804848cd3c2e which removes UBSan suppression. Please re-review :-) |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Rebased! |
1cab4bb to
f094aeb
Compare
f094aeb to
524a876
Compare
|
@luke-jr @promag @MarcoFalke Would you mind re-reviewing? :-) |
|
@MarcoFalke Could this one get a release milestone? :-) |
|
Agree with @laanwj, also (nit) could squash. utACK 524a876 otherwise. |
…an invalid string is passed to DecodeSecret(...)
524a876 to
d855e4c
Compare
promag
left a comment
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.
utACK d855e4c.
…tr, 0, 0)) if an invalid string is passed to DecodeSecret(...) d855e4c Avoid triggering undefined behaviour (std::memset(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...) (practicalswift) Pull request description: Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)`. Background reading: [memcpy (and friends) with NULL pointers](https://www.imperialviolet.org/2016/06/26/nonnull.html) Steps to reproduce: ``` ./configure --with-sanitizers=undefined && make check && ./test/functional/test_runner.py ``` Tree-SHA512: b8325ced4f724d9c03065e0747af56b1f297a90d9fb09a24d46c3231a90dce3df6299f2c41f863b5cec18eaeded7b46ee4b93d9a52adc2541eb4c44d2c0965d9
…an invalid string is passed to DecodeSecret(...) Summary: Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)`. Backport of Bitcoin Core PR14242 bitcoin/bitcoin#14242 Test Plan: ``` make check ``` Reviewers: Fabien, #bitcoin_abc, deadalnix, jasonbcox Reviewed By: #bitcoin_abc, jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D4017
…t(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...) d855e4c Avoid triggering undefined behaviour (std::memset(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...) (practicalswift) Pull request description: Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)`. Background reading: [memcpy (and friends) with NULL pointers](https://www.imperialviolet.org/2016/06/26/nonnull.html) Steps to reproduce: ``` ./configure --with-sanitizers=undefined && make check && ./test/functional/test_runner.py ``` Tree-SHA512: b8325ced4f724d9c03065e0747af56b1f297a90d9fb09a24d46c3231a90dce3df6299f2c41f863b5cec18eaeded7b46ee4b93d9a52adc2541eb4c44d2c0965d9
… the undefined behaviour sanitizer (UBSan) 9f49db7 Enable functional tests in UBSAN job. Enable -fsanitize=integer (part of UBSAN). Merge UBSAN Travis job with no depends. (practicalswift) Pull request description: Run functional tests and benchmarks under the undefined behaviour sanitizer (UBSan). This will make Travis automatically detect issues such as: * bitcoin#14242: Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)` * bitcoin#14239: Avoid dividing by zero (undefined behaviour) in `EstimateMedianVal` (policy)/`ConnectTip` (validation)/`CreateTransaction` (wallet) * bitcoin#13546: wallet: Avoid potential use of uninitialized value `bnb_used` in `CWallet::CreateTransaction(...)` Addresses issue bitcoin#14059. Tree-SHA512: 285e1542b36c582516c47938ce8d999fd89ba6c867bc0976e7306e7c949b8b84ffbfa43dbc679dd97ae639b086092e7d799d8e1c903c66a37d529ce61d5c64b4
… the undefined behaviour sanitizer (UBSan) 9f49db7 Enable functional tests in UBSAN job. Enable -fsanitize=integer (part of UBSAN). Merge UBSAN Travis job with no depends. (practicalswift) Pull request description: Run functional tests and benchmarks under the undefined behaviour sanitizer (UBSan). This will make Travis automatically detect issues such as: * bitcoin#14242: Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)` * bitcoin#14239: Avoid dividing by zero (undefined behaviour) in `EstimateMedianVal` (policy)/`ConnectTip` (validation)/`CreateTransaction` (wallet) * bitcoin#13546: wallet: Avoid potential use of uninitialized value `bnb_used` in `CWallet::CreateTransaction(...)` Addresses issue bitcoin#14059. Tree-SHA512: 285e1542b36c582516c47938ce8d999fd89ba6c867bc0976e7306e7c949b8b84ffbfa43dbc679dd97ae639b086092e7d799d8e1c903c66a37d529ce61d5c64b4 continued 14252 Co-authored-by: UdjinM6 <[email protected]>
…t(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...) d855e4c Avoid triggering undefined behaviour (std::memset(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...) (practicalswift) Pull request description: Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)`. Background reading: [memcpy (and friends) with NULL pointers](https://www.imperialviolet.org/2016/06/26/nonnull.html) Steps to reproduce: ``` ./configure --with-sanitizers=undefined && make check && ./test/functional/test_runner.py ``` Tree-SHA512: b8325ced4f724d9c03065e0747af56b1f297a90d9fb09a24d46c3231a90dce3df6299f2c41f863b5cec18eaeded7b46ee4b93d9a52adc2541eb4c44d2c0965d9
Backports v0.18: PR's bitcoin#14242, 15351 and 14519
…t(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...) d855e4c Avoid triggering undefined behaviour (std::memset(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...) (practicalswift) Pull request description: Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)`. Background reading: [memcpy (and friends) with NULL pointers](https://www.imperialviolet.org/2016/06/26/nonnull.html) Steps to reproduce: ``` ./configure --with-sanitizers=undefined && make check && ./test/functional/test_runner.py ``` Tree-SHA512: b8325ced4f724d9c03065e0747af56b1f297a90d9fb09a24d46c3231a90dce3df6299f2c41f863b5cec18eaeded7b46ee4b93d9a52adc2541eb4c44d2c0965d9
… the undefined behaviour sanitizer (UBSan) 9f49db7 Enable functional tests in UBSAN job. Enable -fsanitize=integer (part of UBSAN). Merge UBSAN Travis job with no depends. (practicalswift) Pull request description: Run functional tests and benchmarks under the undefined behaviour sanitizer (UBSan). This will make Travis automatically detect issues such as: * bitcoin#14242: Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)` * bitcoin#14239: Avoid dividing by zero (undefined behaviour) in `EstimateMedianVal` (policy)/`ConnectTip` (validation)/`CreateTransaction` (wallet) * bitcoin#13546: wallet: Avoid potential use of uninitialized value `bnb_used` in `CWallet::CreateTransaction(...)` Addresses issue bitcoin#14059. Tree-SHA512: 285e1542b36c582516c47938ce8d999fd89ba6c867bc0976e7306e7c949b8b84ffbfa43dbc679dd97ae639b086092e7d799d8e1c903c66a37d529ce61d5c64b4 continued 14252 Co-authored-by: UdjinM6 <[email protected]>
Avoid triggering undefined behaviour (
std::memset(nullptr, 0, 0)) if an invalid string is passed toDecodeSecret(...).Background reading: memcpy (and friends) with NULL pointers
Steps to reproduce: