mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
avvidenc: guard against division by zero
and other nonsensical time base values while we're at it. Coverity 1139699
This commit is contained in:
parent
6d92f18d1b
commit
3529de1784
1 changed files with 12 additions and 0 deletions
|
@ -381,6 +381,11 @@ gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
|
|||
/* fetch pix_fmt, fps, par, width, height... */
|
||||
gst_ffmpeg_videoinfo_to_context (&state->info, ffmpegenc->context);
|
||||
|
||||
/* sanitize time base */
|
||||
if (ffmpegenc->context->time_base.num <= 0
|
||||
|| ffmpegenc->context->time_base.den <= 0)
|
||||
goto insane_timebase;
|
||||
|
||||
if ((oclass->in_plugin->id == AV_CODEC_ID_MPEG4)
|
||||
&& (ffmpegenc->context->time_base.den > 65535)) {
|
||||
/* MPEG4 Standards do not support time_base denominator greater than
|
||||
|
@ -529,6 +534,13 @@ unsupported_codec:
|
|||
GST_DEBUG ("Unsupported codec - no caps found");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
insane_timebase:
|
||||
{
|
||||
GST_ERROR_OBJECT (ffmpegenc, "Rejecting time base %d/%d",
|
||||
ffmpegenc->context->time_base.den, ffmpegenc->context->time_base.num);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue