From edc61914422856c299c63ec8f5401b0258959494 Mon Sep 17 00:00:00 2001 From: paxcut Date: Mon, 13 Apr 2026 04:12:05 -0700 Subject: [PATCH] fix: patterns were not handling the last byte of the input file correctly. --- patterns/7z.hexpat | 2 +- patterns/nbt.hexpat | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/patterns/7z.hexpat b/patterns/7z.hexpat index b3786880..27f3725d 100644 --- a/patterns/7z.hexpat +++ b/patterns/7z.hexpat @@ -46,7 +46,7 @@ struct EndHeader { // Set padding to place End Header in right position padding[startheader.relativeOffsetEndHeader]; // Mark link to meta block - u8 linkToMetaBlock [[color("FF0000")]]; + u8 linkToMetaBlock [[color("FF0000"), no_unique_address]]; // Mark all End Header char fullEndHeader[startheader.theLengthOfEndHeader] [[color("63954A")]]; // Detect LZMA signature diff --git a/patterns/nbt.hexpat b/patterns/nbt.hexpat index 9a8ff029..4646c813 100644 --- a/patterns/nbt.hexpat +++ b/patterns/nbt.hexpat @@ -2,6 +2,7 @@ #pragma description Minecraft NBT import std.sys; +import std.mem; #pragma endian big @@ -73,7 +74,7 @@ struct Element { }; struct NBT { - Element element[while(true)] [[inline]]; + Element element[while(!std::mem::eof())] [[inline]]; }; NBT nbt @ 0x00;