summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorReinhard Nissl <rnissl@gmx.de>2007-04-09 13:39:35 +0000
committerDiego Biurrun <diego@biurrun.de>2007-04-09 13:39:35 +0000
commit6ac9696e774d0fd0905bf08415cc8c58ef1cb3e7 (patch)
tree498a5b305f4446c57bc0c9571c20b440a124a3bf /libavcodec/h264.c
parentff82e429cbf25599b857a6bb484145b372c115ba (diff)
Remove a NAL unit's trailing zero bytes even when dst_length is 1.
Consider the following byte sequence 00 00 01 0a 00 00 00 01 09 ... ^ ^ A B decode_nal() determines dst_length to be 1 (i. e. the byte between label A and B above). However, this byte is a trailing zero byte as the spec says the the current NAL unit is terminated by a byte sequence 00 00 00. The current code used a loop to decrement dst_length accordingly. But the loop doesn't start as the loop condition checks for dst_length > 1, which should read dst_length > 0. patch by Reinhard Nissl, rnissl gmx de Originally committed as revision 8689 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 6daa0f06fa..8675572b80 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -8147,7 +8147,7 @@ static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
if (ptr==NULL || dst_length < 0){
return -1;
}
- while(ptr[dst_length - 1] == 0 && dst_length > 1)
+ while(ptr[dst_length - 1] == 0 && dst_length > 0)
dst_length--;
bit_length= 8*dst_length - decode_rbsp_trailing(h, ptr + dst_length - 1);