Commit 50401f5f authored by Hendrik Leppkes's avatar Hendrik Leppkes

avcodec: properly check pkt_timebase for validity

Unset/invalid timebases have a zero numerator.
This makes the checks consistent with other timebase checks and fixes an
integer division by 0.
parent 3c6781b4
...@@ -412,7 +412,7 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_si ...@@ -412,7 +412,7 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_si
} }
} }
if (avctx->pkt_timebase.den && pkt->pts != AV_NOPTS_VALUE) if (avctx->pkt_timebase.num && pkt->pts != AV_NOPTS_VALUE)
ctx->pts = av_rescale_q(pkt->pts, avctx->pkt_timebase, AV_TIME_BASE_Q); ctx->pts = av_rescale_q(pkt->pts, avctx->pkt_timebase, AV_TIME_BASE_Q);
if (pkt->size) { if (pkt->size) {
......
...@@ -2435,7 +2435,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, ...@@ -2435,7 +2435,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
} else { } else {
avctx->internal->pkt = &pkt_recoded; avctx->internal->pkt = &pkt_recoded;
if (avctx->pkt_timebase.den && avpkt->pts != AV_NOPTS_VALUE) if (avctx->pkt_timebase.num && avpkt->pts != AV_NOPTS_VALUE)
sub->pts = av_rescale_q(avpkt->pts, sub->pts = av_rescale_q(avpkt->pts,
avctx->pkt_timebase, AV_TIME_BASE_Q); avctx->pkt_timebase, AV_TIME_BASE_Q);
ret = avctx->codec->decode(avctx, sub, got_sub_ptr, &pkt_recoded); ret = avctx->codec->decode(avctx, sub, got_sub_ptr, &pkt_recoded);
......
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