From ae858ebe70a73b3c8031249b95e09f6896708e60 Mon Sep 17 00:00:00 2001 From: _ <_@_> Date: Sat, 30 Sep 2023 10:08:13 -0500 Subject: [PATCH] :bug: bug: patch loader --- src/loader.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/loader.rs b/src/loader.rs index a3241a8..1611244 100644 --- a/src/loader.rs +++ b/src/loader.rs @@ -296,24 +296,27 @@ pub fn parse_block (rdr: &mut R, blocks: &mut Vec ) // I think this is delta line numbers, e.g. most instructions // have 0, but when you go to a new source line it's 1+. - let lineinfo_count = parse_int (rdr).unwrap (); + let lineinfo_count = load_size (rdr); for _ in 0..lineinfo_count { parse_byte (rdr).unwrap (); } // Absolute line info, didn't see that in my test files - let abslineinfo_count = parse_int (rdr).unwrap (); - assert_eq! (abslineinfo_count, 0); - - let local_count = parse_int (rdr).unwrap (); - for _ in 0..local_count { - parse_string(rdr).unwrap (); - parse_int (rdr).unwrap (); - parse_int (rdr).unwrap (); + let abslineinfo_count = load_size (rdr); + for _ in 0..abslineinfo_count { + load_unsigned (rdr, usize::MAX); + load_unsigned (rdr, usize::MAX); } - let upvalue_count = parse_int (rdr).unwrap (); + let local_count = load_size (rdr); + for _ in 0..local_count { + parse_string(rdr); + load_unsigned (rdr, usize::MAX); + load_unsigned (rdr, usize::MAX); + } + + let upvalue_count = load_size (rdr); for _ in 0..upvalue_count { parse_string (rdr).unwrap (); }