On 16.12.2016 02:29, Rodger Combs wrote: >> On Dec 15, 2016, at 19:21, Andreas Cadhalpun >> <andreas.cadhal...@googlemail.com> wrote: >> On 15.12.2016 14:02, Ronald S. Bultje wrote: >>> - if for whatever reason some things cannot be done in generic code or by >>> changing the type (this should really cover most cases), and we want >>> specific overflow checks, then maybe we want to have some generic helper >>> macros that make them one-liners in decoders. This would return an error >>> along with fixing the UB. >> >> I don't think the number of overflow checks added justifies the additional >> complexity of factoring things out. These checks are also subtly different, >> so it's not easy to write a generic helper for that. >> However, I plan to do this for the actually common cases when validating >> codec parameters, like checking that a parameter is not negative. >> > > My proposal was for something like: > #define BAIL_ON_OVERFLOW(x) if (x) {av_log(avctx, AV_LOG_ERROR, "Overflow > check failed: " #x); return AVERROR_INVALIDDATA;} > Which basically reduces the code overhead down to a simple one-liner.
Yeah, that's similar to how I plan to handle the more common cases. > It's hard to get detailed error prints out of this, but if we're saying these > cases are so unlikely (fuzzer-only?) that we're comfortable outright failing > on them, the level of precision in the message probably doesn't matter much? Agreed, so I've updated the patch series using this approach. Best regards, Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel