From c10417f62b623e742b9d1310a4cafd0a9144e4fb Mon Sep 17 00:00:00 2001 From: ggn Date: Sat, 14 Aug 2021 18:11:17 +0300 Subject: [PATCH] Fix for bug #187 - add more strict checks for .incbin sizes --- direct.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/direct.c b/direct.c index 607ad7c..e3685d1 100644 --- a/direct.c +++ b/direct.c @@ -622,6 +622,10 @@ allright: close(fd); return ERROR; } + if ((int64_t)size <= 0) + { + return error("invalid incbin size requested"); + } } else size = lseek(fd, 0L, SEEK_END); @@ -642,6 +646,10 @@ allright: lseek(fd, pos, SEEK_SET); size -= pos; + if ((int64_t)size < 0) + { + return error("requested incbin size out of range"); + } } else { -- 2.37.2