summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 8675572b80..4fcdb75bce 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -8149,7 +8149,7 @@ static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
}
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);