From 979f70177ed0b609ac81091da54ba9a0d20e5ab3 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Wed, 21 Jul 2021 22:22:49 -0400 Subject: [PATCH] Fix handling of XXXX fields in plugin header --- src/parser.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parser.rs b/src/parser.rs index 757331c..17c62b4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -336,7 +336,11 @@ fn parse_plugin_header(input: &[u8]) -> IResult<&[u8], PluginHeader> { let mut large_size = None; while consumed_bytes < tes4.size as u32 { let (remaining, field) = parse_field_header(input)?; - consumed_bytes += field.size as u32 + FIELD_HEADER_SIZE; + if let Some(size) = large_size { + consumed_bytes += size + FIELD_HEADER_SIZE; + } else { + consumed_bytes += field.size as u32 + FIELD_HEADER_SIZE; + } input = remaining; match field.field_type { "CNAM" => {