[FFmpeg-devel] [PATCH 1/2] drawtext: add expansion function eif()

Stefano Sabatini stefasab at gmail.com
Thu Jul 17 13:28:53 CEST 2014


On date Sunday 2014-07-06 13:46:31 +0300, Andrey Utkin encoded:
> 2014-07-05 16:19 GMT+03:00 Nicolas George <george at nsup.org>:
> > Le sextidi 16 messidor, an CCXXII, Andrey Utkin a écrit :
> >> + at item eif
> >
> > I find the name obscure. Where does it come from?
> 
> Yes, it is somewhat obscure. It comes from "expr_int_format".
> 
> >> +    if (!strchr("xXdu", argv[1][0])) {
> >
> > You should probably check that argv[1][1] is 0.
> 
> Can be added to check for stray trailing symbols in passed argument,
> but this doesn't affect the algorithm, it uses only first character.
> 
> >> +    feclearexcept(FE_ALL_EXCEPT);
> >> +    intval = res;
> >> +    if ((ret = fetestexcept(FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW))) {
> >> +        av_log(ctx, AV_LOG_ERROR, "Conversion of floating-point result to int failed. Control register: 0x%08x. Conversion result: %d\n", ret, intval);
> >> +        return AVERROR(EINVAL);
> >
> > Is this portable enough? Anyway, AFAIK, we never do that kind of test in the
> > code.
> 
> This must be coming from C standard. I consulted with this CERT C
> Secure Coding Standards chapter:
> https://www.securecoding.cert.org/confluence/display/seccode/FLP03-C.+Detect+and+handle+floating-point+errors

Patch applied, further tweaking can be done later.
-- 
FFmpeg = Freak and Frenzy Mean Powerful Enchanting God


More information about the ffmpeg-devel mailing list