patterns/ani: Improved compatibility with error size defined in ani files (#354)

This commit is contained in:
eli_w
2025-03-22 20:46:49 +08:00
committed by GitHub
parent df97fc7257
commit 5ad7f0c1e7
2 changed files with 6 additions and 1 deletions

View File

@@ -36,7 +36,12 @@ struct RiffChunk {
u32 size;
if (signature == "RIFF" || signature == "LIST") {
char type[4];
RiffChunk chunks[while($ - addressof(type) < size)];
// Compatible with error size defined in ani files
u32 remain = sizeof($) - addressof(type);
u32 marked = size > remain ? remain : size;
RiffChunk chunks[while($ - addressof(type) < marked)];
} else if (signature[0] == 'I' && parent.type == "INFO") {
char info[size];
} else if (signature == "anih") {