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

Andrey Utkin andrey.krieger.utkin at gmail.com
Sun Jul 6 12:46:31 CEST 2014


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

-- 
Andrey Utkin


More information about the ffmpeg-devel mailing list