Forgotten 4 patches

This commit is contained in:
Hubbitus 2015-03-11 02:11:51 +03:00
parent b007aa783b
commit 070181a3f3
4 changed files with 153 additions and 0 deletions

View File

@ -0,0 +1,69 @@
Index: ImageMagick/branches/ImageMagick-6/ChangeLog
===================================================================
--- a/ImageMagick/branches/ImageMagick-6/ChangeLog
+++ b/ImageMagick/branches/ImageMagick-6/ChangeLog
@@ -1,6 +1,8 @@
2013-07-01 6.8.6-3 Cristy <quetzlzacatenango@image...>
* New version 6.8.6-3, SVN revision 12579.
+ * Fixed infinite loop in HDR reader (reference
+ http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=26929).
2013-06-26 6.8.6-3 Cristy <quetzlzacatenango@image...>
* Improve HCL to RGB roundtrip (reference
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=22384).
Index: ImageMagick/branches/ImageMagick-6/coders/hdr.c
===================================================================
--- a/ImageMagick/branches/ImageMagick-6/coders/hdr.c
+++ b/ImageMagick/branches/ImageMagick-6/coders/hdr.c
@@ -275,5 +275,5 @@
continue;
p=value;
- while ((c != '\n') && (c != '\0'))
+ while ((c != '\n') && (c != '\0') && (c != EOF))
{
if ((size_t) (p-value) < (MaxTextExtent-1))
@@ -320,16 +320,18 @@
white_point[2];
- (void) sscanf(value,"%g %g %g %g %g %g %g %g",
- &chromaticity[0],&chromaticity[1],&chromaticity[2],
- &chromaticity[3],&chromaticity[4],&chromaticity[5],
- &white_point[0],&white_point[1]);
- image->chromaticity.red_primary.x=chromaticity[0];
- image->chromaticity.red_primary.y=chromaticity[1];
- image->chromaticity.green_primary.x=chromaticity[2];
- image->chromaticity.green_primary.y=chromaticity[3];
- image->chromaticity.blue_primary.x=chromaticity[4];
- image->chromaticity.blue_primary.y=chromaticity[5];
- image->chromaticity.white_point.x=white_point[0],
- image->chromaticity.white_point.y=white_point[1];
+ if (sscanf(value,"%g %g %g %g %g %g %g %g",&chromaticity[0],
+ &chromaticity[1],&chromaticity[2],&chromaticity[3],
+ &chromaticity[4],&chromaticity[5],&white_point[0],
+ &white_point[1]) == 8)
+ {
+ image->chromaticity.red_primary.x=chromaticity[0];
+ image->chromaticity.red_primary.y=chromaticity[1];
+ image->chromaticity.green_primary.x=chromaticity[2];
+ image->chromaticity.green_primary.y=chromaticity[3];
+ image->chromaticity.blue_primary.x=chromaticity[4];
+ image->chromaticity.blue_primary.y=chromaticity[5];
+ image->chromaticity.white_point.x=white_point[0],
+ image->chromaticity.white_point.y=white_point[1];
+ }
break;
}
@@ -350,7 +352,9 @@
width;
- (void) sscanf(value,"%d +X %d",&height,&width);
- image->columns=(size_t) width;
- image->rows=(size_t) height;
+ if (sscanf(value,"%d +X %d",&height,&width) == 2)
+ {
+ image->columns=(size_t) width;
+ image->rows=(size_t) height;
+ }
break;
}

View File

@ -0,0 +1,54 @@
diff -ur ImageMagick-6.8.6-3.miff-orig/coders/miff.c ImageMagick-6.8.6-3/coders/miff.c
--- ImageMagick-6.8.6-3.miff-orig/coders/miff.c 2013-05-17 22:58:19.000000000 +0400
+++ ImageMagick-6.8.6-3/coders/miff.c 2015-03-10 22:37:49.930865595 +0300
@@ -1399,6 +1399,9 @@
bzip_info.avail_out=(unsigned int) (packet_size*image->columns);
do
{
+ int
+ code;
+
if (bzip_info.avail_in == 0)
{
bzip_info.next_in=(char *) compress_pixels;
@@ -1408,7 +1411,13 @@
bzip_info.avail_in=(unsigned int) ReadBlob(image,length,
(unsigned char *) bzip_info.next_in);
}
- if (BZ2_bzDecompress(&bzip_info) == BZ_STREAM_END)
+ code=BZ2_bzDecompress(&bzip_info);
+ if (code < 0)
+ {
+ status=MagickFalse;
+ break;
+ }
+ if (code == BZ_STREAM_END)
break;
} while (bzip_info.avail_out != 0);
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
@@ -1455,6 +1464,9 @@
zip_info.avail_out=(uInt) (packet_size*image->columns);
do
{
+ int
+ code;
+
if (zip_info.avail_in == 0)
{
zip_info.next_in=compress_pixels;
@@ -1464,7 +1476,13 @@
zip_info.avail_in=(unsigned int) ReadBlob(image,length,
zip_info.next_in);
}
- if (inflate(&zip_info,Z_SYNC_FLUSH) == Z_STREAM_END)
+ code=inflate(&zip_info,Z_SYNC_FLUSH);
+ if (code < 0)
+ {
+ status=MagickFalse;
+ break;
+ }
+ if (code == Z_STREAM_END)
break;
} while (zip_info.avail_out != 0);
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
Только в ImageMagick-6.8.6-3/coders: miff.c.orig

View File

@ -0,0 +1,19 @@
Index: ImageMagick/branches/ImageMagick-6/coders/pdb.c
===================================================================
--- a/ImageMagick/branches/ImageMagick-6/coders/pdb.c
+++ b/ImageMagick/branches/ImageMagick-6/coders/pdb.c
@@ -372,5 +372,13 @@
}
num_pad_bytes = (size_t) (img_offset - TellBlob( image ));
- while (num_pad_bytes--) ReadBlobByte( image );
+ while (num_pad_bytes-- != 0)
+ {
+ int
+ c;
+
+ c=ReadBlobByte(image);
+ if (c == EOF)
+ break;
+ }
/*
Read image header.

View File

@ -0,0 +1,11 @@
Index: ImageMagick/branches/ImageMagick-6/coders/vicar.c
===================================================================
--- a/ImageMagick/branches/ImageMagick-6/coders/vicar.c
+++ b/ImageMagick/branches/ImageMagick-6/coders/vicar.c
@@ -276,4 +276,6 @@
{
c=ReadBlobByte(image);
+ if (c == EOF)
+ break;
count++;
}