From: ggn Date: Sat, 14 Aug 2021 15:11:17 +0000 (+0300) Subject: Fix for bug #187 - add more strict checks for .incbin sizes X-Git-Tag: v2.1.11~1 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=commitdiff_plain;h=c10417f62b623e742b9d1310a4cafd0a9144e4fb Fix for bug #187 - add more strict checks for .incbin sizes --- 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 {