commit 1c63df1c2b941743c25244c10e3265f168e8b339
parent 6bf3eb5ea1104f55279af5466d3b3aeecd910be8
Author: Frederic Cambus <fred@statdns.com>
Date: Wed, 7 Aug 2019 09:23:41 +0200
Limit input file height and width to 4096.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/pcx2gba.c b/pcx2gba.c
@@ -105,6 +105,11 @@ int main(int argc, char *argv[]) {
pcx_header.x_max++;
pcx_header.y_max++;
+ if ((pcx_header.x_max) > 4096 || (pcx_header.y_max) > 4096) {
+ printf("ERROR: Input File height or width is larger than 4096\n\n");
+ return EXIT_FAILURE;
+ }
+
/* Uncompress RLE encoded PCX Input File */
pcx_buffer_size = pcx_header.x_max * pcx_header.y_max;
pcx_buffer = malloc(pcx_buffer_size);