diff options
author | 2017-01-25 17:49:53 +0100 | |
---|---|---|
committer | 2017-01-25 17:49:53 +0100 | |
commit | 78a7342750182687a08060c5e060cb897800e9f6 (patch) | |
tree | 73ab5b3a3b09c56a73a74950a71701adf7a22cc7 /3rdparty/libjpeg/jcinit.c | |
parent | 93c92be81517a982ef9b47eed610a3e42ed244bc (diff) |
updated libjpeg to 9c (nw)
Diffstat (limited to '3rdparty/libjpeg/jcinit.c')
-rw-r--r-- | 3rdparty/libjpeg/jcinit.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/3rdparty/libjpeg/jcinit.c b/3rdparty/libjpeg/jcinit.c index 0ba310f217d..1e13e3462d6 100644 --- a/3rdparty/libjpeg/jcinit.c +++ b/3rdparty/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 */); |