commit 9d19d9008eb70d069b799dd65a68bb410a5dff8e (tree)
parent 6a89751025abc074d31bbbab5b01a7e701f1abce
Author: LemonBoy <thatlemon@gmail.com>
Date: Sun, 22 Mar 2020 22:47:28 +0100
debug: Correct version check in debug_line parser
Version 3 is similar to version 2 plus more opcodes.
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/std/dwarf.zig b/lib/std/dwarf.zig
@@ -717,8 +717,7 @@ pub const DwarfInfo = struct {
const next_offset = unit_length + (if (is_64) @as(usize, 12) else @as(usize, 4));
const version = try in.readInt(u16, di.endian);
- // TODO support 3 and 5
- if (version != 2 and version != 4) return error.InvalidDebugInfo;
+ if (version < 2 or version > 4) return error.InvalidDebugInfo;
const prologue_length = if (is_64) try in.readInt(u64, di.endian) else try in.readInt(u32, di.endian);
const prog_start_offset = (try seekable.getPos()) + prologue_length;