~ubuntu-branches/ubuntu/lucid/gimp/lucid-proposed

« back to all changes in this revision

Viewing changes to plug-ins/common/file-pcx.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-02-26 19:10:31 UTC
  • mfrom: (1.1.22 upstream) (0.4.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100226191031-d11l96bebdllen1n
Tags: 2.6.8-2ubuntu1
* Merge with debian, remaining changes:
  + debian/patches/02_help-message.patch,
    debian/patches/03_gimp.desktop.in.in.patch:
    - updated some strings for ubuntu
  + debian/rules:
    - updated translation templates
  + debian/control:
    - set Vcs-Bzr url

Show diffs side-by-side

added added

removed removed

Lines of Context:
406
406
      return -1;
407
407
    }
408
408
 
 
409
  /* Shield against potential buffer overflows in load_*() functions. */
 
410
  if (G_MAXSIZE / width / height < 3)
 
411
    {
 
412
      g_message (_("Image dimensions too large: width %d x height %d"), width, height);
 
413
      return -1;
 
414
    }
 
415
 
409
416
  if (pcx_header.planes == 3 && pcx_header.bpp == 8)
410
417
    {
411
418
      image= gimp_image_new (width, height, GIMP_RGB);
425
432
 
426
433
  if (pcx_header.planes == 1 && pcx_header.bpp == 1)
427
434
    {
428
 
      dest = (guchar *) g_malloc (width * height);
 
435
      dest = g_new (guchar, ((gsize) width) * height);
429
436
      load_1 (fd, width, height, dest, bytesperline);
430
437
      gimp_image_set_colormap (image, mono, 2);
431
438
    }
432
439
  else if (pcx_header.planes == 4 && pcx_header.bpp == 1)
433
440
    {
434
 
      dest = (guchar *) g_malloc (width * height);
 
441
      dest = g_new (guchar, ((gsize) width) * height);
435
442
      load_4 (fd, width, height, dest, bytesperline);
436
443
      gimp_image_set_colormap (image, pcx_header.colormap, 16);
437
444
    }
438
445
  else if (pcx_header.planes == 1 && pcx_header.bpp == 8)
439
446
    {
440
 
      dest = (guchar *) g_malloc (width * height);
 
447
      dest = g_new (guchar, ((gsize) width) * height);
441
448
      load_8 (fd, width, height, dest, bytesperline);
442
449
      fseek (fd, -768L, SEEK_END);
443
450
      fread (cmap, 768, 1, fd);
445
452
    }
446
453
  else if (pcx_header.planes == 3 && pcx_header.bpp == 8)
447
454
    {
448
 
      dest = (guchar *) g_malloc (width * height * 3);
 
455
      dest = g_new (guchar, ((gsize) width) * height * 3);
449
456
      load_24 (fd, width, height, dest, bytesperline);
450
457
    }
451
458
  else