Commit 4ed899f2 authored by Andrew Wason's avatar Andrew Wason Committed by Carl Eugen Hoyos

Fix crash when decoding DV in AVI introduced in r24579 (issue 2174).

Patch by Andrew Wason, rectalogic rectalogic com

Originally committed as revision 25023 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent a10a9f5c
...@@ -759,7 +759,7 @@ static AVStream *get_subtitle_pkt(AVFormatContext *s, AVStream *next_st, ...@@ -759,7 +759,7 @@ static AVStream *get_subtitle_pkt(AVFormatContext *s, AVStream *next_st,
for (i=0; i<s->nb_streams; i++) { for (i=0; i<s->nb_streams; i++) {
st = s->streams[i]; st = s->streams[i];
ast = st->priv_data; ast = st->priv_data;
if (st->discard < AVDISCARD_ALL && ast->sub_pkt.data) { if (st->discard < AVDISCARD_ALL && ast && ast->sub_pkt.data) {
ts = av_rescale_q(ast->sub_pkt.dts, st->time_base, AV_TIME_BASE_Q); ts = av_rescale_q(ast->sub_pkt.dts, st->time_base, AV_TIME_BASE_Q);
if (ts <= next_ts && ts < ts_min) { if (ts <= next_ts && ts < ts_min) {
ts_min = ts; ts_min = ts;
...@@ -1294,12 +1294,14 @@ static int avi_read_close(AVFormatContext *s) ...@@ -1294,12 +1294,14 @@ static int avi_read_close(AVFormatContext *s)
AVStream *st = s->streams[i]; AVStream *st = s->streams[i];
AVIStream *ast = st->priv_data; AVIStream *ast = st->priv_data;
av_free(st->codec->palctrl); av_free(st->codec->palctrl);
if (ast) {
if (ast->sub_ctx) { if (ast->sub_ctx) {
av_freep(&ast->sub_ctx->pb); av_freep(&ast->sub_ctx->pb);
av_close_input_stream(ast->sub_ctx); av_close_input_stream(ast->sub_ctx);
} }
av_free(ast->sub_buffer); av_free(ast->sub_buffer);
av_free_packet(&ast->sub_pkt); av_free_packet(&ast->sub_pkt);
}
} }
if (avi->dv_demux) if (avi->dv_demux)
......
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