summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Strange <astrange@ithinksw.com>2009-07-03 05:52:00 +0000
committerAlexander Strange <astrange@ithinksw.com>2009-07-03 05:52:00 +0000
commit0410ee8f868ae307517f8554f2aa3a11b511dac5 (patch)
tree3e160f4331cc96081a3dc2439d6b5c06a5b6e68d
parentbda1ad1e736b55bb698abae8f844ca2d11b9c6c5 (diff)
H.264: Don't set data_partitioning for invalid NAL_DPA.
Before, the decoder could interpret a corrupt frame as a NAL_DPA and NAL_DPC, and then start decoding even if decode_slice_header() returned an error. This frequently caused crashes. Fixes issue1228, issue1229, and partially issue1238. Originally committed as revision 19328 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/h264.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 9cdac24605..c5630b7b2d 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -7603,9 +7603,12 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
init_get_bits(&hx->s.gb, ptr, bit_length);
hx->intra_gb_ptr=
hx->inter_gb_ptr= NULL;
+
+ if ((err = decode_slice_header(hx, h)) < 0)
+ break;
+
hx->s.data_partitioning = 1;
- err = decode_slice_header(hx, h);
break;
case NAL_DPB:
init_get_bits(&hx->intra_gb, ptr, bit_length);