From a46861d0d33a7d786b05ebac903b5c48d9e665e3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 12:23:08 -0500 Subject: [PATCH] test(tga): retain truncation coverage below allocation budget --- crates/tga/src/tests.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/tga/src/tests.rs b/crates/tga/src/tests.rs index 887c2915a..bec6b6972 100644 --- a/crates/tga/src/tests.rs +++ b/crates/tga/src/tests.rs @@ -92,6 +92,11 @@ fn hostile_headers_fail_without_allocating() { assert_eq!(dec(&f), Err(Error::LimitExceeded("pixel count"))); let mut f = header(10, 16384, 16384, 32, 0); f.extend_from_slice(&[0xFF, 1, 2, 3, 4]); + // The aggregate decoded-storage budget rejects this before any allocation. + assert_eq!(dec(&f), Err(Error::LimitExceeded("decode allocation bytes"))); + // Under budget, an incomplete RLE stream must still fail as truncated. + let mut f = header(10, 16, 16, 32, 0); + f.extend_from_slice(&[0xFF, 1, 2, 3, 4]); // only 128 of 256 pixels assert_eq!(dec(&f), Err(Error::Malformed("truncated run-length data"))); let mut f = header(2, 4, 4, 24, 0); f.extend_from_slice(&[0; 10]);