Merge pull request #100386 from hpvb/core-ubsan

Core: Fix UBSAN reports
This commit is contained in:
Rémi Verschelde 2024-12-18 17:23:32 +01:00
commit 851d8e49e8
No known key found for this signature in database
GPG key ID: C3336907360768E1
40 changed files with 373 additions and 248 deletions

View file

@ -200,7 +200,7 @@ Error ResourceUID::save_to_cache() {
cache_entries = 0;
for (KeyValue<ID, Cache> &E : unique_ids) {
f->store_64(E.key);
f->store_64(uint64_t(E.key));
uint32_t s = E.value.cs.length();
f->store_32(s);
f->store_buffer((const uint8_t *)E.value.cs.ptr(), s);
@ -263,7 +263,7 @@ Error ResourceUID::update_cache() {
}
f->seek_end();
}
f->store_64(E.key);
f->store_64(uint64_t(E.key));
uint32_t s = E.value.cs.length();
f->store_32(s);
f->store_buffer((const uint8_t *)E.value.cs.ptr(), s);