mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Make InputMemoryStream::read_LEB128_*
templated
On i686, reading integers larger than `2^32 - 1` would fail as the 32-bit `size_t` parameter would overflow. This caused us to read too few bytes in LibDebug's DWARF parser. Making this method templated solves this issue, as we now can call this API with a `u64` parameter.
This commit is contained in:
parent
a59b9357e3
commit
efd1aea969
Notes:
sideshowbarker
2024-07-18 07:16:37 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/efd1aea969f Pull-request: https://github.com/SerenityOS/serenity/pull/8718 Issue: https://github.com/SerenityOS/serenity/issues/363 Reviewed-by: https://github.com/gunnarbeutner ✅ Reviewed-by: https://github.com/nico
1 changed files with 4 additions and 2 deletions
|
@ -74,9 +74,11 @@ public:
|
|||
return m_bytes[m_offset];
|
||||
}
|
||||
|
||||
bool read_LEB128_unsigned(size_t& result) { return LEB128::read_unsigned(*this, result); }
|
||||
template<typename ValueType>
|
||||
bool read_LEB128_unsigned(ValueType& result) { return LEB128::read_unsigned(*this, result); }
|
||||
|
||||
bool read_LEB128_signed(ssize_t& result) { return LEB128::read_signed(*this, result); }
|
||||
template<typename ValueType>
|
||||
bool read_LEB128_signed(ValueType& result) { return LEB128::read_signed(*this, result); }
|
||||
|
||||
ReadonlyBytes bytes() const { return m_bytes; }
|
||||
size_t offset() const { return m_offset; }
|
||||
|
|
Loading…
Reference in a new issue