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:
Daniel Bertalan 2021-07-27 09:42:57 +02:00 committed by Andreas Kling
parent a59b9357e3
commit efd1aea969
Notes: sideshowbarker 2024-07-18 07:16:37 +09:00

View file

@ -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; }