From: Paul B Mahol <one...@gmail.com>

On 2012-03-14 14:36:49 +0100, Diego Biurrun wrote:
> On Wed, Mar 14, 2012 at 02:29:34PM +0100, Janne Grunau wrote:
> > On 2012-03-14 04:02:02 +0000, Paul B Mahol wrote:
> > > --- a/libavcodec/jvdec.c
> > > +++ b/libavcodec/jvdec.c
> > > @@ -150,7 +150,7 @@ static int decode_frame(AVCodecContext *avctx,
> > >
> > >          if (video_type == 0 || video_type == 1) {
> > >              GetBitContext gb;
> > > -            init_get_bits(&gb, buf, FFMIN(video_size, (buf_end - buf) * 
> > > 8));
> > > +            init_get_bits(&gb, buf, FFMIN(video_size * 8, (buf_end - 
> > > buf) * 8));
> >
> > ok and queued
>
> A slightly more descriptive error message would be appreciated.

as you wish. I've also factored the multipliction out of the FFMIN().

Janne

---8<---
The safe bitstream reader broke it since the buffer size was specified
in bytes instead of bits.

Signed-off-by: Janne Grunau <janne-li...@jannau.net>
CC: libav-sta...@libav.org
---
 libavcodec/jvdec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 5d4fdea..ffa2f5a 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -150,7 +150,7 @@ static int decode_frame(AVCodecContext *avctx,
 
         if (video_type == 0 || video_type == 1) {
             GetBitContext gb;
-            init_get_bits(&gb, buf, FFMIN(video_size, (buf_end - buf) * 8));
+            init_get_bits(&gb, buf, 8 * FFMIN(video_size, buf_end - buf));
 
             for (j = 0; j < avctx->height; j += 8)
                 for (i = 0; i < avctx->width; i += 8)
-- 
1.7.8.5

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to