1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:47:36 +00:00

LibDebug: Fix truncation in ExtendedOpcodes::SetDiscriminator

The parameter of this operator is an unsigned LEB128 integer, so it can
be more than 1 byte in length. If we only read 1 byte, we might mess up
the offsets for the instructions following it.
This commit is contained in:
Daniel Bertalan 2021-12-05 07:52:53 +01:00 committed by Brian Gianforcaro
parent d3f5416b70
commit 7546295abe

View file

@ -170,7 +170,8 @@ void LineProgram::handle_extended_opcode()
}
case ExtendedOpcodes::SetDiscriminator: {
dbgln_if(DWARF_DEBUG, "SetDiscriminator");
m_stream.discard_or_error(1);
size_t discriminator;
m_stream.read_LEB128_unsigned(discriminator);
break;
}
default: