]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - jpeg.c
corrected a few LittleLongs to LittleFloat in md3 loading (EEP those were bad)
[xonotic/darkplaces.git] / jpeg.c
diff --git a/jpeg.c b/jpeg.c
index 063a86f427c216331b26647bb3f68bb3e0356bcf..b65e04a49e8e042137161b655cb657fbf62e76c5 100644 (file)
--- a/jpeg.c
+++ b/jpeg.c
@@ -414,7 +414,7 @@ qboolean JPEG_OpenLibrary (void)
        // Load the DLL
        if (! (jpeg_dll = Sys_LoadLibrary (dllname)))
        {
-               Con_Printf ("Can't find %s. JPEG support disabled\n", dllname);
+               Con_DPrintf("Can't find %s. JPEG support disabled\n", dllname);
                return false;
        }
 
@@ -422,12 +422,12 @@ qboolean JPEG_OpenLibrary (void)
        for (func = jpegfuncs; func && func->name != NULL; func++)
                if (!(*func->funcvariable = (void *) Sys_GetProcAddress (jpeg_dll, func->name)))
                {
-                       Con_Printf ("missing function \"%s\" - broken JPEG library!\n", func->name);
+                       Con_Printf("missing function \"%s\" - broken JPEG library!\n", func->name);
                        JPEG_CloseLibrary ();
                        return false;
                }
 
-       Con_Printf ("%s loaded. JPEG support enabled\n", dllname);
+       Con_DPrintf("%s loaded. JPEG support enabled\n", dllname);
        return true;
 }
 
@@ -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);