Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35688. ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste |
maflcko
left a comment
There was a problem hiding this comment.
Seems fine to change this, but at least for me it is really hard to follow the commit description, as it seems to mix several different broad topics:
- It claims that #35010 is related to null-annotations where both the src/dst are zero-size. This is not true, because #35010 is about size mismatches, where the dst is too small to fit the src.
- It claims that #35010 is related to the discussion (and was picked up in the discussion) in #35118 (comment), however I fail to see the link.
- Then it links to https://godbolt.org/z/jMPP8EhEr, which also has a type-check includes. However, the types here are the same: both are
uint8_tfor src and dst. - It mixes in the eval_script fuzz target change, which could make sense to split up into a separate commit.
Again, seems fine to change, but the commit message can be a bit shorter and basically just say something like:
crypto: accept empty HMAC keys
This avoids an Ubsan nullptr warning on memcpy, when passing empty HMAC keys.
With the warning gone, workarounds in the tests can be removed.
Though, feel free to ignore/adjust. I think that commit messages and pull descriptions should be clean and concise, and opinions and extended discussions are better left to GH review or issue comments.
Replace `memcpy` with `std::copy` so empty HMAC keys do not trigger a UBSan null-pointer warning.
Add empty-key test vectors and let the crypto fuzz target exercise empty byte vectors directly.
Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^[email protected]>
`ConsumeRemainingBytes()` already returns before copying when no bytes remain, so call it directly.
ac1ddae to
dc67c4c
Compare
Problem:
CHMAC_SHA256andCHMAC_SHA512usememcpyto copy key bytes.Empty vectors can provide a null
data()pointer, which triggers a UBSan null-pointer warning even for zero-length copies and forces the crypto fuzz target to avoid empty inputs.Fix: Use
std::copy, which has defined semantics for empty ranges, add empty-key HMAC test vectors, and let the crypto fuzz target pass empty byte vectors directly.Remove the stale
eval_scriptempty-input guard in a separate commit becauseConsumeRemainingBytes()already returns before copying when no bytes remain.