[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec pnm.c,1.11,1.12

Michael Niedermayer CVS michael
Sun Aug 21 17:45:01 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv27046

Modified Files:
	pnm.c 
Log Message:
segfault fix


Index: pnm.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/pnm.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- pnm.c	10 May 2005 20:39:11 -0000	1.11
+++ pnm.c	21 Aug 2005 15:44:59 -0000	1.12
@@ -198,6 +198,8 @@
     do_read:
         ptr = p->data[0];
         linesize = p->linesize[0];
+        if(s->bytestream + n*avctx->height > s->bytestream_end)
+            return -1;
         for(i = 0; i < avctx->height; i++) {
             memcpy(ptr, s->bytestream, n);
             s->bytestream += n;
@@ -211,6 +213,8 @@
             n = avctx->width;
             ptr = p->data[0];
             linesize = p->linesize[0];
+            if(s->bytestream + n*avctx->height*3/2 > s->bytestream_end)
+                return -1;
             for(i = 0; i < avctx->height; i++) {
                 memcpy(ptr, s->bytestream, n);
                 s->bytestream += n;
@@ -233,6 +237,8 @@
     case PIX_FMT_RGBA32:
         ptr = p->data[0];
         linesize = p->linesize[0];
+        if(s->bytestream + avctx->width*avctx->height*4 > s->bytestream_end)
+            return -1;
         for(i = 0; i < avctx->height; i++) {
             int j, r, g, b, a;
 





More information about the ffmpeg-cvslog mailing list