summaryrefslogtreecommitdiff
path: root/libavcodec/assdec.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-02-29 13:46:13 +0100
committerNicolas George <nicolas.george@normalesup.org>2012-03-07 16:41:30 +0100
commite5dd4ae7284bb290d8dc8e9cd3f2e035d1d77cd0 (patch)
treeccdd8130e4f462aa6fbb7b3b7340c65754b092a8 /libavcodec/assdec.c
parent1eabd71c2bed13648643433249386f4b965b5c14 (diff)
assdec: avoid a possible NULL dereference.
Diffstat (limited to 'libavcodec/assdec.c')
-rw-r--r--libavcodec/assdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c
index c5f9cab6e0..47ea3308f4 100644
--- a/libavcodec/assdec.c
+++ b/libavcodec/assdec.c
@@ -41,8 +41,11 @@ static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,
int len, size = avpkt->size;
while (size > 0) {
+ int duration;
ASSDialog *dialog = ff_ass_split_dialog(avctx->priv_data, ptr, 0, NULL);
- int duration = dialog->end - dialog->start;
+ if (!dialog)
+ return AVERROR_INVALIDDATA;
+ duration = dialog->end - dialog->start;
len = ff_ass_add_rect(data, ptr, 0, duration, 1);
if (len < 0)
return len;