~ubuntu-branches/ubuntu/trusty/xplanet/trusty

« back to all changes in this revision

Viewing changes to src/libimage/jpeg.c

  • Committer: Package Import Robot
  • Author(s): Steve McIntyre
  • Date: 2014-01-30 18:54:10 UTC
  • mfrom: (4.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20140130185410-o2u51emh707gbevv
Tags: 1.3.0-1
* New maintainer
* Move to new upstream version 1.3.0. (Closes: #678464)
  + Upstream highlights:
    - add "outlined" keyword to marker files
    - update JPL ephemeris code for 64 bit machines
    - add bump_shade config file parameter
    - add opacity keyword for markers
    - implement Rayleigh scattering
  + Remove old Debian patches now obsoleted:
    - possible-buffer-overflow (included upstream)
    - orbit-step-bug (included upstream)
    - gcc44-includes (included upstream)
    - hyphen-used-as-minus-sign (included upstream)
    - tsc-aspect-ratio (included upstream)
  + Update (and include!) FreeMonoBold
* Update libtiff build-deps (Closes: #736052)
* Update libpng build-deps (Closes: #662568)
* Update Standards-Version to 3.9.5
* Update to debhelper 9 to enable hardening build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <jpeglib.h>
25
25
 
 
26
#define MAX_DIMENSION 21600
 
27
 
26
28
int
27
29
read_jpeg(const char *filename, int *width, int *height, unsigned char **rgb)
28
30
{
42
44
    *width = cinfo.output_width;
43
45
    *height = cinfo.output_height;
44
46
 
 
47
    /* Prevent against integer overflow - thanks to Niels Heinen */
 
48
    if (cinfo.output_width > MAX_DIMENSION 
 
49
        || cinfo.output_height > MAX_DIMENSION) 
 
50
    {
 
51
       fprintf(stderr, "Width, height in JPEG header is %d, %d\n",
 
52
               cinfo.output_width, cinfo.output_height);
 
53
       return(0);
 
54
    }
 
55
 
45
56
    rgb[0] = malloc(3 * cinfo.output_width * cinfo.output_height);
46
57
    if (rgb[0] == NULL)
47
58
    {
48
59
        fprintf(stderr, "Can't allocate memory for JPEG file.\n");
49
 
        fclose(infile);
 
60
        fclose(infile);
50
61
        return(0);
51
62
    }
52
63
 
65
76
        if (ptr == NULL)
66
77
        {
67
78
            fprintf(stderr, "Can't allocate memory for JPEG file.\n");
68
 
            fclose(infile);
 
79
            fclose(infile);
69
80
            return(0);
70
81
        }
71
82