Commit 682e8a69 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/h264_sei: Try to make code more robust by jumping to the specified SEI ends

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent f9f7f4c9
...@@ -245,7 +245,7 @@ static int decode_frame_packing(H264Context *h, int size){ ...@@ -245,7 +245,7 @@ static int decode_frame_packing(H264Context *h, int size){
int ff_h264_decode_sei(H264Context *h){ int ff_h264_decode_sei(H264Context *h){
while (get_bits_left(&h->gb) > 16) { while (get_bits_left(&h->gb) > 16) {
int type; int type;
unsigned size; unsigned size, next;
type=0; type=0;
do{ do{
...@@ -268,6 +268,7 @@ int ff_h264_decode_sei(H264Context *h){ ...@@ -268,6 +268,7 @@ int ff_h264_decode_sei(H264Context *h){
av_log(h->avctx, AV_LOG_ERROR, "SEI truncated\n"); av_log(h->avctx, AV_LOG_ERROR, "SEI truncated\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
next = get_bits_count(&h->gb) + 8*size;
switch(type){ switch(type){
case SEI_TYPE_PIC_TIMING: // Picture timing SEI case SEI_TYPE_PIC_TIMING: // Picture timing SEI
...@@ -293,9 +294,8 @@ int ff_h264_decode_sei(H264Context *h){ ...@@ -293,9 +294,8 @@ int ff_h264_decode_sei(H264Context *h){
case SEI_TYPE_FRAME_PACKING: case SEI_TYPE_FRAME_PACKING:
if(decode_frame_packing(h, size) < 0) if(decode_frame_packing(h, size) < 0)
return -1; return -1;
default:
skip_bits_long(&h->gb, 8*size);
} }
skip_bits_long(&h->gb, next - get_bits_count(&h->gb));
//FIXME check bits here //FIXME check bits here
align_get_bits(&h->gb); align_get_bits(&h->gb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment