Mercurial > libavcodec.hg
changeset 4830:5a523aee7379 libavcodec
When dst_length == 0 bit_length has to be 0, too, but the current code still
calls decode_rbsp_trailing() and therefore bit_length might get negative.
Although the remaining code is able to handle a negative bit_length, avoid
the calculation at all by setting bit_length to 0 for dst_length == 0.
patch by Reinhard Nissl, rnissl gmx de
author | diego |
---|---|
date | Mon, 09 Apr 2007 14:10:07 +0000 |
parents | e3161603a048 |
children | 4a7e1f5cdc7a |
files | h264.c |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/h264.c Mon Apr 09 13:39:35 2007 +0000 +++ b/h264.c Mon Apr 09 14:10:07 2007 +0000 @@ -8149,7 +8149,7 @@ } while(ptr[dst_length - 1] == 0 && dst_length > 0) dst_length--; - bit_length= 8*dst_length - decode_rbsp_trailing(h, ptr + dst_length - 1); + bit_length= !dst_length ? 0 : (8*dst_length - decode_rbsp_trailing(h, ptr + dst_length - 1)); if(s->avctx->debug&FF_DEBUG_STARTCODE){ av_log(h->s.avctx, AV_LOG_DEBUG, "NAL %d at %d/%d length %d\n", h->nal_unit_type, buf_index, buf_size, dst_length);