From b1930341ccd39443d11264bc69d83a27c16f19e1 Mon Sep 17 00:00:00 2001
From: Per Hedbor <ph@opera.com>
Date: Sat, 25 Mar 2000 19:18:21 +0100
Subject: [PATCH] Fixed read-outside-of-memory bug, not really serious, though

Rev: src/modules/Image/encodings/png.c:1.29
---
 src/modules/Image/encodings/png.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/modules/Image/encodings/png.c b/src/modules/Image/encodings/png.c
index b50f361147..2edb0bd262 100644
--- a/src/modules/Image/encodings/png.c
+++ b/src/modules/Image/encodings/png.c
@@ -1,5 +1,5 @@
 #include "global.h"
-RCSID("$Id: png.c,v 1.28 1999/11/14 22:16:09 mast Exp $");
+RCSID("$Id: png.c,v 1.29 2000/03/25 18:18:21 per Exp $");
 
 #include "image_machine.h"
 
@@ -898,7 +898,7 @@ static int _png_write_rgb(rgb_group *w1,
 	 switch (bpp)
 	 {
 	    case 8:
-	       if (n>len/3) n=len/3;
+	       if (n>len/4) n=len/4;
 	       while (n)
 	       {
 		  d1->r=*(s++);
@@ -911,7 +911,7 @@ static int _png_write_rgb(rgb_group *w1,
 	       }
 	       break;
 	    case 16:
-	       if (n>len/6) n=len/6;
+	       if (n>len/8) n=len/8;
 	       while (n)
 	       {
 		  d1->r=*(s++);
-- 
GitLab