Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-updates-src > by-pkgid > 60dc7c17a8e8b238ea25e0c9ed2adfeb > files > 4

libgd-2.2.4-1.2.mga5.src.rpm

From: "Christoph M. Becker" <cmbecker69@gmx.de>
Date: Wed, 18 Jan 2017 21:06:29 +0100
Subject: Fix tiff_invalid_read check

---
 src/gd_io_dp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gd_io_dp.c b/src/gd_io_dp.c
index eda2eeb..cb38794 100644
--- a/src/gd_io_dp.c
+++ b/src/gd_io_dp.c
@@ -292,6 +292,10 @@ static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len)
 		rlen = dp->realSize - dp->pos;
 	}
 
+	if (rlen < 0) {
+		return 0;
+	}
+
 	memcpy(buf, (void *) ((char *)dp->data + dp->pos), rlen);
 	dp->pos += rlen;