From 32b2de36efd19178130073f171723a4e026e6ef2 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Tue, 11 Mar 2025 23:32:01 +0100 Subject: [PATCH] Codefix: check the table header is actually being read --- src/saveload/saveload.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index f2cce1b9d5..3579db5d9d 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -2110,7 +2110,7 @@ static void SlLoadChunk(const ChunkHandler &ch) /* The header should always be at the start. Read the length; the * Load() should as first action process the header. */ if (_sl.expect_table_header) { - SlIterateArray(); + if (SlIterateArray() != INT32_MAX) SlErrorCorrupt("Table chunk without header"); } switch (_sl.block_mode) { @@ -2163,7 +2163,7 @@ static void SlLoadCheckChunk(const ChunkHandler &ch) /* The header should always be at the start. Read the length; the * LoadCheck() should as first action process the header. */ if (_sl.expect_table_header) { - SlIterateArray(); + if (SlIterateArray() != INT32_MAX) SlErrorCorrupt("Table chunk without header"); } switch (_sl.block_mode) {