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.

45 lines
1.5 KiB

  1. Description: CVE-2014-9330
  2. Integer overflow in bmp2tiff
  3. Origin: upstream, http://bugzilla.maptools.org/show_bug.cgi?id=2494
  4. Bug: http://bugzilla.maptools.org/show_bug.cgi?id=2494
  5. Bug-Debian: http://bugs.debian.org/773987
  6. Index: tiff/tools/bmp2tiff.c
  7. ===================================================================
  8. --- tiff.orig/tools/bmp2tiff.c
  9. +++ tiff/tools/bmp2tiff.c
  10. @@ -1,4 +1,4 @@
  11. -/* $Id: bmp2tiff.c,v 1.23 2010-03-10 18:56:49 bfriesen Exp $
  12. +/* $Id: bmp2tiff.c,v 1.24 2014-12-21 15:15:32 erouault Exp $
  13. *
  14. * Project: libtiff tools
  15. * Purpose: Convert Windows BMP files in TIFF.
  16. @@ -403,6 +403,13 @@ main(int argc, char* argv[])
  17. width = info_hdr.iWidth;
  18. length = (info_hdr.iHeight > 0) ? info_hdr.iHeight : -info_hdr.iHeight;
  19. + if( width <= 0 || length <= 0 )
  20. + {
  21. + TIFFError(infilename,
  22. + "Invalid dimensions of BMP file" );
  23. + close(fd);
  24. + return -1;
  25. + }
  26. switch (info_hdr.iBitCount)
  27. {
  28. @@ -593,6 +600,14 @@ main(int argc, char* argv[])
  29. compr_size = file_hdr.iSize - file_hdr.iOffBits;
  30. uncompr_size = width * length;
  31. + /* Detect int overflow */
  32. + if( uncompr_size / width != length )
  33. + {
  34. + TIFFError(infilename,
  35. + "Invalid dimensions of BMP file" );
  36. + close(fd);
  37. + return -1;
  38. + }
  39. comprbuf = (unsigned char *) _TIFFmalloc( compr_size );
  40. if (!comprbuf) {
  41. TIFFError(infilename,