[FFmpeg-devel] [PATCH 5/9] nistspheredec: prevent overflow during block alignment calculation

Marton Balint cus at passwd.hu
Sun Jan 29 05:02:10 EET 2017


On Sun, 29 Jan 2017, Andreas Cadhalpun wrote:

> On 28.01.2017 12:44, Marton Balint wrote:
>> If we reduce the number of extra lines (not at any cost), I think that helps.
>> There is also a solution which keeps the traditional C syntax, and is easy to undestand even at first glance.
>> 
>> if (st->codecpar->channels > FF_SANE_NB_CHANNELS)
>>     return ff_elog(AVERROR(ENOSYS), s, "Too many channels %d > %d\n", st->codecpar->channels, FF_SANE_NB_CHANNELS);
>
> How would you define ff_elog for this to work?
>

static inline int ff_elog(int error, void *log_ctx, const char *fmt, ...) 
{
     if (!CONFIG_SMALL) {
         va_list vl;
         va_start(vl, fmt);
         av_vlog(log_ctx, AV_LOG_ERROR, fmt, vl);
         va_end(vl);
     }
     return error;
}

Regards,
Marton


More information about the ffmpeg-devel mailing list