changeset 2788:1bf080e490db libavcodec

fix segfault (bug #1165640)
author michael
date Mon, 11 Jul 2005 22:56:23 +0000
parents af90d5dc83f0
children 587ed6630b5d
files 8bps.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/8bps.c	Mon Jul 11 22:34:34 2005 +0000
+++ b/8bps.c	Mon Jul 11 22:56:23 2005 +0000
@@ -100,11 +100,13 @@
 			dlen = be2me_16(*(unsigned short *)(lp+row*2));
 			/* Decode a row of this plane */
 			while(dlen > 0) {
+				if(dp + 1 >= buf+buf_size) return -1;
 				if ((count = *dp++) <= 127) {
 					count++;
 					dlen -= count + 1;
 					if (pixptr + count * px_inc > pixptr_end)
 					    break;
+					if(dp + count > buf+buf_size) return -1;
 					while(count--) {
 						*pixptr = *dp++;
 						pixptr += px_inc;