[FFmpeg-devel] [PATCH] Fix DV uninitialized reads

Reimar Döffinger Reimar.Doeffinger
Tue Sep 29 21:21:35 CEST 2009


On Tue, Sep 29, 2009 at 11:56:43AM -0700, Baptiste Coudurier wrote:
> On 9/29/09 11:51 AM, Reimar D?ffinger wrote:
> >Index: libavcodec/dv.c
> >===================================================================
> >--- libavcodec/dv.c     (revision 20081)
> >+++ libavcodec/dv.c     (working copy)
> >@@ -1102,8 +1102,17 @@
> >              av_log(NULL, AV_LOG_ERROR, "ac bitstream overflow\n");
> >      }
> >
> >-    for (j=0; j<5*s->sys->bpm; j++)
> >+    for (j=0; j<5*s->sys->bpm; j++) {
> >+       int pos;
> >+       int size = pbs[j].size_in_bits>>  3;
> >         flush_put_bits(&pbs[j]);
> >+       pos = put_bits_count(&pbs[j])>>  3;
> >+       if (pos>  size) {
> >+           av_log(NULL, AV_LOG_ERROR, "bitstream written beyond buffer size\n");
> >+           return -1;
> >+       }
> >+       memset(pbs[j].buf + pos, 0xff, size - pos);
> >+    }
> >
> >      return 0;
> >  }
> 
> Yes, this one is nice, I guess we do not have avctx available for
> av_log ? If we don't, commit, we can add the context to av_log
> later.

Applied, and avctx is indeed available.
I took the liberty to change the other av_log(NULL to use it, too.



More information about the ffmpeg-devel mailing list