summaryrefslogtreecommitdiff
path: root/plugins/AdvaImg/src/LibJPEG/jcinit.c
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2014-12-13 20:28:24 +0000
committerKirill Volinsky <mataes2007@gmail.com>2014-12-13 20:28:24 +0000
commitd2d798d0f11abcbf141db69869e76e8d123ec1eb (patch)
treecee8645964030b4b80231952885911f724850d12 /plugins/AdvaImg/src/LibJPEG/jcinit.c
parenta400ebf572dcad9b43d1b641b1742814f8b5e8a5 (diff)
FreeImage updated to 3.16
git-svn-id: http://svn.miranda-ng.org/main/trunk@11379 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AdvaImg/src/LibJPEG/jcinit.c')
-rw-r--r--plugins/AdvaImg/src/LibJPEG/jcinit.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/AdvaImg/src/LibJPEG/jcinit.c b/plugins/AdvaImg/src/LibJPEG/jcinit.c
index f7aa89fdb3..397b488aee 100644
--- a/plugins/AdvaImg/src/LibJPEG/jcinit.c
+++ b/plugins/AdvaImg/src/LibJPEG/jcinit.c
@@ -2,6 +2,7 @@
* jcinit.c
*
* Copyright (C) 1991-1997, Thomas G. Lane.
+ * Modified 2003-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -29,6 +30,24 @@
GLOBAL(void)
jinit_compress_master (j_compress_ptr cinfo)
{
+ long samplesperrow;
+ JDIMENSION jd_samplesperrow;
+
+ /* For now, precision must match compiled-in value... */
+ if (cinfo->data_precision != BITS_IN_JSAMPLE)
+ ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
+
+ /* Sanity check on image dimensions */
+ if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
+ cinfo->input_components <= 0)
+ ERREXIT(cinfo, JERR_EMPTY_IMAGE);
+
+ /* Width of an input scanline must be representable as JDIMENSION. */
+ samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components;
+ jd_samplesperrow = (JDIMENSION) samplesperrow;
+ if ((long) jd_samplesperrow != samplesperrow)
+ ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
+
/* Initialize master control (includes parameter checking/processing) */
jinit_c_master_control(cinfo, FALSE /* full compression */);