~ubuntu-branches/ubuntu/raring/imagemagick/raring-security

« back to all changes in this revision

Viewing changes to coders/png.c

  • Committer: Package Import Robot
  • Author(s): Jamie Strandboge
  • Date: 2012-08-17 09:31:02 UTC
  • Revision ID: package-import@ubuntu.com-20120817093102-6fstrobujixglovr
Tags: 8:6.7.7.10-2ubuntu4
* SECURITY UPDATE: denial of service via large resource consumption
  - debian/patches/CVE-2012-3437.patch: always use correct size argument
    with libpng memory allocation
  - CVE-2012-3437

Show diffs side-by-side

added added

removed removed

Lines of Context:
1756
1756
}
1757
1757
 
1758
1758
#ifdef PNG_USER_MEM_SUPPORTED
1759
 
static png_voidp Magick_png_malloc(png_structp png_ptr,png_uint_32 size)
 
1759
#if PNG_LIBPNG_VER >= 14000
 
1760
static png_voidp Magick_png_malloc(png_structp png_ptr,png_alloc_size_t size)
 
1761
#else
 
1762
static png_voidp Magick_png_malloc(png_structp png_ptr,png_size_t size)
 
1763
#endif
1760
1764
{
1761
1765
  (void) png_ptr;
1762
1766
  return((png_voidp) AcquireMagickMemory((size_t) size));
7309
7313
         (char *) profile_type, (double) length);
7310
7314
     }
7311
7315
 
7312
 
   text=(png_textp) png_malloc(ping,(png_uint_32) sizeof(png_text));
 
7316
#if PNG_LIBPNG_VER >= 14000
 
7317
   text=(png_textp) png_malloc(ping,(png_alloc_size_t) sizeof(png_text));
 
7318
#else
 
7319
   text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text));
 
7320
#endif
7313
7321
   description_length=(png_uint_32) strlen((const char *) profile_description);
7314
7322
   allocated_length=(png_uint_32) (length*2 + (length >> 5) + 20
7315
7323
      + description_length);
7316
 
   text[0].text=(png_charp) png_malloc(ping,allocated_length);
7317
 
   text[0].key=(png_charp) png_malloc(ping, (png_uint_32) 80);
 
7324
#if PNG_LIBPNG_VER >= 14000
 
7325
   text[0].text=(png_charp) png_malloc(ping,
 
7326
      (png_alloc_size_t) allocated_length);
 
7327
   text[0].key=(png_charp) png_malloc(ping, (png_alloc_size_t) 80);
 
7328
#else
 
7329
   text[0].text=(png_charp) png_malloc(ping, (png_size_t) allocated_length);
 
7330
   text[0].key=(png_charp) png_malloc(ping, (png_size_t) 80);
 
7331
#endif
7318
7332
   text[0].key[0]='\0';
7319
7333
   (void) ConcatenateMagickString(text[0].key,
7320
7334
      "Raw profile type ",MaxTextExtent);
10667
10681
        {
10668
10682
        if (value != (const char *) NULL)
10669
10683
          {
10670
 
            text=(png_textp) png_malloc(ping,(png_uint_32) sizeof(png_text));
 
10684
 
 
10685
#if PNG_LIBPNG_VER >= 14000
 
10686
            text=(png_textp) png_malloc(ping,
 
10687
                 (png_alloc_size_t) sizeof(png_text));
 
10688
#else
 
10689
            text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text));
 
10690
#endif
10671
10691
            text[0].key=(char *) property;
10672
10692
            text[0].text=(char *) value;
10673
10693
            text[0].text_length=strlen(value);