mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
Merge bitcoin/bitcoin#31655: refactor: Avoid UB in SHA3_256::Write
fabeca3458refactor: Avoid UB in SHA3_256::Write (MarcoFalke)fad4032b21refactor: Drop unused UCharCast (MarcoFalke) Pull request description: It is UB to apply a distance to a pointer or iterator further than the end itself, even if the distance is (partially) revoked later on. Fix the issue by advancing the data pointer at most to the end. This fix is required to adopt C++ safe buffers https://github.com/bitcoin/bitcoin/issues/31272. Also included is a somewhat unrelated commit. ACKs for top commit: sipa: utACKfabeca3458theuni: utACKfabeca3458hebasto: ACKfabeca3458. Tree-SHA512: 78c53691322b72c3ba9c25ec94eec275dbbbc3049b0ad45e7d9fb2df0afbbaa905b0d8fa7106a3582f937bb1dc15a7592c4ad2d80fe4cff1062a3acfd3638f08
This commit is contained in:
@@ -603,7 +603,7 @@ void BerkeleyRODatabase::Open()
|
||||
|
||||
// Read subdatabase page number
|
||||
// It is written as a big endian 32 bit number
|
||||
uint32_t main_db_page = ReadBE32(UCharCast(std::get<DataRecord>(page.records.at(1)).data.data()));
|
||||
uint32_t main_db_page = ReadBE32(std::get<DataRecord>(page.records.at(1)).data.data());
|
||||
|
||||
// The main database is in a page that doesn't exist
|
||||
if (main_db_page > outer_meta.last_page) {
|
||||
|
||||
Reference in New Issue
Block a user