You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1002 B

  1. Index: tiff-4.0.3/tools/ppm2tiff.c
  2. ===================================================================
  3. --- tiff-4.0.3.orig/tools/ppm2tiff.c 2013-06-23 10:36:50.779629492 -0400
  4. +++ tiff-4.0.3/tools/ppm2tiff.c 2013-06-23 10:36:50.775629494 -0400
  5. @@ -89,6 +89,7 @@
  6. int c;
  7. extern int optind;
  8. extern char* optarg;
  9. + tmsize_t scanline_size;
  10. if (argc < 2) {
  11. fprintf(stderr, "%s: Too few arguments\n", argv[0]);
  12. @@ -237,8 +238,16 @@
  13. }
  14. if (TIFFScanlineSize(out) > linebytes)
  15. buf = (unsigned char *)_TIFFmalloc(linebytes);
  16. - else
  17. - buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
  18. + else {
  19. + scanline_size = TIFFScanlineSize(out);
  20. + if (scanline_size != 0)
  21. + buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
  22. + else {
  23. + fprintf(stderr, "%s: scanline size overflow\n",infile);
  24. + (void) TIFFClose(out);
  25. + exit(-2);
  26. + }
  27. + }
  28. if (resolution > 0) {
  29. TIFFSetField(out, TIFFTAG_XRESOLUTION, resolution);
  30. TIFFSetField(out, TIFFTAG_YRESOLUTION, resolution);