commit 4da229f2161a9dff94729c47c166ca42e02251c2
parent bf81d9feeeb1fbd0d6a6902b58e8368ce83f1058
Author: Frederic Cambus <fred@statdns.com>
Date: Mon, 18 Nov 2019 09:41:03 +0100
Add another format validation check (palette size) in the XBin loader.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c
@@ -77,6 +77,11 @@ ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options)
uint32_t loop;
uint32_t index;
+ if (offset + XBIN_PALETTE_LENGTH > ctx->length) {
+ ctx->error = ANSILOVE_FORMAT_ERROR;
+ return -1;
+ }
+
for (loop = 0; loop < 16; loop++) {
index = (loop * 3) + offset;