]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - jpeg.c
added gl_mesh_batching (default on) which merges several meshes in a row to reduce...
[xonotic/darkplaces.git] / jpeg.c
diff --git a/jpeg.c b/jpeg.c
index 063a86f427c216331b26647bb3f68bb3e0356bcf..26c8318ee9bad5177550d4326ec765770c819916 100644 (file)
--- a/jpeg.c
+++ b/jpeg.c
@@ -534,6 +534,11 @@ qbyte* JPEG_LoadImage (qbyte *f, int matchwidth, int matchheight)
                qjpeg_destroy_decompress (&cinfo);
                return NULL;
        }
+       if (image_width > 4096 || image_height > 4096 || image_width <= 0 || image_height <= 0)
+       {
+               Con_Printf("JPEG_LoadImage: invalid image size %ix%i\n", image_width, image_height);
+               return NULL;
+       }
 
        image_rgba = Mem_Alloc(tempmempool, image_width * image_height * 4);
        scanline = Mem_Alloc(tempmempool, image_width * cinfo.output_components);