mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
LibDebug+LibCoredump: Use ByteReader to do unaligned reads
The previous solution of "lol whats a UB" was not nice and tripped over itself when it was run under UBSAN, fix this by doing explicit byte-by-byte reads where needed.
This commit is contained in:
parent
6d64b13a1b
commit
da3c4e5df5
3 changed files with 18 additions and 11 deletions
|
@ -9,6 +9,7 @@
|
|||
#include "AttributeValue.h"
|
||||
#include "CompilationUnit.h"
|
||||
|
||||
#include <AK/ByteReader.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <LibDebug/DebugInfo.h>
|
||||
|
||||
|
@ -344,8 +345,8 @@ void DwarfInfo::build_cached_dies() const
|
|||
auto index = ranges->as_unsigned();
|
||||
auto base = die.compilation_unit().range_lists_base();
|
||||
// FIXME: This assumes that the format is DWARf32
|
||||
auto offsets = reinterpret_cast<u32 const*>(debug_range_lists_data().offset(base));
|
||||
offset = offsets[index] + base;
|
||||
auto offsets = debug_range_lists_data().slice(base);
|
||||
offset = ByteReader::load32(offsets.offset_pointer(index * sizeof(u32))) + base;
|
||||
}
|
||||
|
||||
Vector<DIERange> entries;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue