Skip to content

Commit

Permalink
Merge 99c2ee7 into merged_master (Elements PR ElementsProject#1399)
Browse files Browse the repository at this point in the history
  • Loading branch information
delta1 committed Feb 12, 2025
2 parents 20dcf54 + 99c2ee7 commit 1ba6aee
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ class CDiskBlockIndex : public CBlockIndex
bool RemoveDynaFedMaskOnSerialize(bool for_read) {
if (for_read) {
bool is_dyna = nVersion < 0;
nVersion = ~CBlockHeader::DYNAFED_HF_MASK & nVersion;
nVersion = (int32_t) (~CBlockHeader::DYNAFED_HF_MASK & (uint32_t)nVersion);
return is_dyna;
} else {
return is_dynafed_block();
Expand Down
4 changes: 4 additions & 0 deletions src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,10 @@ static RPCHelpMan getcompactsketch()
CDataStream ssBlock(block_bytes, SER_NETWORK, PROTOCOL_VERSION);
ssBlock >> block;

if (block.vtx.empty()) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Cannot obtain sketch of empty block.");
}

CBlockHeaderAndShortTxIDs cmpctblock(block);

CDataStream ssCompactBlock(SER_NETWORK, PROTOCOL_VERSION);
Expand Down
4 changes: 2 additions & 2 deletions src/test/fuzz/witness_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ FUZZ_TARGET_INIT(witness_program, initialize_witness_program)

CScriptWitness witness;
int fuzz_control;
int flags;
unsigned flags;
ds >> fuzz_control;
ds >> witness.stack;
ds >> flags;
Expand All @@ -64,7 +64,7 @@ FUZZ_TARGET_INIT(witness_program, initialize_witness_program)

if (fuzz_control & 1) {
unsigned char hash_program[32];
CSHA256().Write(&program[0], program.size()).Finalize(hash_program);
CSHA256().Write(program.data(), program.size()).Finalize(hash_program);
CScript scriptPubKey = CScript{} << OP_0 << std::vector<unsigned char>(hash_program, hash_program + sizeof(hash_program));
witness.stack.push_back(program);

Expand Down
2 changes: 2 additions & 0 deletions test/sanitizer_suppressions/ubsan
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ implicit-integer-sign-change:primitives/confidential.cpp
implicit-integer-sign-change:primitives/confidential.h
shift-base:simplicity/sha256.c
unsigned-integer-overflow:simplicity/sha256.c
# See comment in simplicity/primitive/elements/env.c line 303
unsigned-integer-overflow:simplicity/primitive/elements/env.c

0 comments on commit 1ba6aee

Please sign in to comment.