From 463eb3a18155d848733e33afbc75bfdccc9a1784 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 16 Mar 2015 16:57:13 +0000 Subject: Update bundled libjpeg from jpeg-8c to jpeg-9a. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10626 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- jpeg/jcinit.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'jpeg/jcinit.c') diff --git a/jpeg/jcinit.c b/jpeg/jcinit.c index 0ba310f21..1e13e3462 100644 --- a/jpeg/jcinit.c +++ b/jpeg/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 */); -- cgit v1.2.3