[FFmpeg-devel] [PATCH 1/3] timecode: better input checks in init function.

Michael Niedermayer michaelni at gmx.at
Tue Dec 6 19:50:38 CET 2011


On Tue, Dec 06, 2011 at 11:37:37AM +0100, Clément Bœsch wrote:
> From: Clément Bœsch <clement.boesch at smartjog.com>
> 
> ---
>  libavcodec/timecode.c |   37 ++++++++++++++++++++++++++++++-------
>  1 files changed, 30 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/timecode.c b/libavcodec/timecode.c
> index 7f3b1d5..4148f32 100644
> --- a/libavcodec/timecode.c
> +++ b/libavcodec/timecode.c
> @@ -55,9 +55,32 @@ uint32_t ff_framenum_to_smtpe_timecode(unsigned frame, int fps, int drop)
>             (  (frame / (fps * 3600) % 24)) % 10;          // units of hours
>  }
>  
> +static int ff_check_timecode_rate(void *avcl, AVRational rate, int drop)
> +{
> +    int fps = (rate.num + rate.den/2) / rate.den;
> +
> +    if (!rate.num || !rate.den) {
> +        av_log(avcl, AV_LOG_ERROR, "Timecode frame rate must be specified\n");

you check ==0 after dividing by 0

otherwise teh patch LGTM

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111206/3f7c7443/attachment.asc>


More information about the ffmpeg-devel mailing list