rpms/ocaml-camlimages/EL-4 camlimages-oversized-png-check-CVE-2009-2295.patch, NONE, 1.1 ocaml-camlimages.spec, 1.2, 1.3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Author: rjones

Update of /cvs/pkgs/rpms/ocaml-camlimages/EL-4
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv3049

Modified Files:
	ocaml-camlimages.spec 
Added Files:
	camlimages-oversized-png-check-CVE-2009-2295.patch 
Log Message:
- ocaml-camlimages: PNG reader multiple integer overflows
  (CVE 2009-2295 / RHBZ#509531).


camlimages-oversized-png-check-CVE-2009-2295.patch:

--- NEW FILE camlimages-oversized-png-check-CVE-2009-2295.patch ---
--- camlimages-3.0.1/src/pngread.c	2007-01-18 10:29:57.000000000 +0000
+++ camlimages-3.0.1-oversized-png-checks/src/pngread.c	2009-07-03 14:19:42.000000000 +0100
@@ -26,6 +26,12 @@
 #define PNG_TAG_INDEX16 2
 #define PNG_TAG_INDEX4 3
 
+/* Test if x or y are negative, or if multiplying x * y would cause an
+ * arithmetic overflow.
+ */
+#define oversized(x, y)						\
+  ((x) < 0 || (y) < 0 || (x) * (y) < (x) || (x) * (y) < (y))
+
 value read_png_file_as_rgb24( name )
      value name;
 {
@@ -81,6 +87,9 @@
   png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
 	       &interlace_type, NULL, NULL);
 
+  if (oversized (width, height))
+    failwith ("png error: image contains oversized or bogus width and height");
+
   if ( color_type == PNG_COLOR_TYPE_GRAY ||
        color_type == PNG_COLOR_TYPE_GRAY_ALPHA ) { 
     png_set_gray_to_rgb(png_ptr); 
@@ -102,6 +111,9 @@
 
   rowbytes = png_get_rowbytes(png_ptr, info_ptr);
 
+  if (oversized (rowbytes, height))
+    failwith ("png error: image contains oversized or bogus rowbytes and height");
+
   {
     int i;
     png_bytep *row_pointers;
@@ -235,6 +247,9 @@
   png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
 	       &interlace_type, NULL, NULL);
 
+  if (oversized (width, height))
+    failwith ("png error: image contains oversized or bogus width and height");
+
   if ( color_type == PNG_COLOR_TYPE_GRAY ||
        color_type == PNG_COLOR_TYPE_GRAY_ALPHA ) { 
     png_set_gray_to_rgb(png_ptr); 
@@ -251,6 +266,9 @@
 
   rowbytes = png_get_rowbytes(png_ptr, info_ptr);
 
+  if (oversized (rowbytes, height))
+    failwith ("png error: image contains oversized or bogus rowbytes and height");
+
 /*
 fprintf(stderr, "pngread.c: actual loading\n"); fflush(stderr);
 */


Index: ocaml-camlimages.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ocaml-camlimages/EL-4/ocaml-camlimages.spec,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- ocaml-camlimages.spec	9 May 2007 02:53:13 -0000	1.2
+++ ocaml-camlimages.spec	3 Jul 2009 13:59:36 -0000	1.3
@@ -1,6 +1,6 @@
 Name:           ocaml-camlimages
 Version:        2.2.0
-Release:        8%{?dist}
+Release:        9%{?dist}
 Summary:        OCaml image processing library
 
 Group:          Development/Libraries
@@ -9,6 +9,10 @@ URL:            http://pauillac.inria.fr
 Source0:        ftp://ftp.inria.fr/INRIA/Projects/cristal/caml-light/bazar-ocaml/camlimages-%{version}.tgz
 Source1:        camlimages-2.2.0-htmlref.tar.gz
 Patch0:         camlimages-2.2.0-stubdest.patch
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=509531#c4
+Patch1:         camlimages-oversized-png-check-CVE-2009-2295.patch
+
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 # Excluding on ppc64 due to missing dependencies (Bug #239518)
@@ -43,7 +47,12 @@ Includes documentation provided by ocaml
 
 %prep
 %setup -q -n camlimages-2.2 -a 1
-%patch -p1
+%patch0 -p1
+
+pushd png
+%patch1 -p2
+popd
+
 sed -i -e 's|LIBRARYDIRS=ppm bmp xvthumb jpeg tiff gif png xpm ps graphics freetype|LIBRARYDIRS=%buildlibs|' Makefile.build.in
 
 %build
@@ -73,6 +82,10 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Fri Jul  3 2009 Richard W.M. Jones <rjones@xxxxxxxxxx> - 2.2.0-8
+- ocaml-camlimages: PNG reader multiple integer overflows
+  (CVE 2009-2295 / RHBZ#509531).
+
 * Wed May 09 2007 Nigel Jones <dev@xxxxxxxxxx> 2.2.0-8
 - Exclude ppc64 builds due to missing ocaml
 

_______________________________________________
Fedora-ocaml-list mailing list
Fedora-ocaml-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-ocaml-list

[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux