On Mon, Dec 12, 2011 at 03:08:16PM +0000, Måns Rullgård wrote:
> Luca Barbato <[email protected]> writes:
> 
> > On 12/12/11 15:54, Gaurav Narula wrote:
> >> ---
> >>   libavcodec/kmvc.c |   82 
> >> ++++++++++++++++++++++++++++++++++++++++++----------
> >>   1 files changed, 66 insertions(+), 16 deletions(-)
> >>
> >> diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c
> >> index 07ca194..7f63699 100644
> >> --- a/libavcodec/kmvc.c
> >> +++ b/libavcodec/kmvc.c
> >> @@ -57,17 +57,21 @@ typedef struct BitBuf {
> >>
> >>   #define kmvc_init_getbits(bb, src)  bb.bits = 7; bb.bitbuf = *src++;
> >>
> >> -#define kmvc_getbit(bb, src, res) {\
> >> +#define kmvc_getbit(bb, src, src_end, res) {\
> >>       res = 0; \
> >>       if (bb.bitbuf&  (1<<  bb.bits)) res = 1; \
> >>       bb.bits--; \
> >>       if(bb.bits == -1) { \
> >> +        if (src>= src_end) { \
> >> +            av_log(ctx->avctx, AV_LOG_ERROR, "Data overrun\n"); \
> >> +            return AVERROR_INVALIDDATA; \
> >> +        } \
> >>           bb.bitbuf = *src++; \
> >>           bb.bits = 7; \
> >>       } \
> >>   }
> >
> > res == 1 is an error condition that always triggers a return, am I
> > wrong?
> 
> res is the bit that was read.

Indeed.
 
> The real question is why this decoder isn't using get_bits.h.

Because it's not possible. Bits here are packed into bytes that are
interspersed with data bytes.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to