I've sent a follow up patch set implementing saturating operations if that's something folks are interested in.
- dale On Thu, Apr 30, 2020 at 2:18 PM Dale Curtis <[email protected]> wrote: > That said, instead of aborting the operation, perhaps it'd make more sense > for library functions to be av_saturated_add(), av_saturated_sub() which > saturate to INT64_MIN/MAX. > > - dale > > On Thu, Apr 30, 2020 at 1:26 PM Dale Curtis <[email protected]> > wrote: > >> Aside: This overflow check is used in quite a few places now. I wonder if >> it's worth having a function like the following: >> >> int64_t av_no_overflow_add(int64_t a, int64_t b) { >> return (a > 0 ? b <= INT64_MAX - a : b >= INT64_MIN - a) ? a + b : a; >> } >> >> Better name suggestions welcome... av_maybe_add_ts? >> >> On Thu, Apr 30, 2020 at 1:17 PM Dale Curtis <[email protected]> >> wrote: >> >>> This applies the same workaround used elsewhere in the file for handling >>> overflow of addition. >>> >>> Signed-off-by: Dale Curtis <[email protected]> >>> --- >>> libavformat/utils.c | 15 +++++++++++---- >>> 1 file changed, 11 insertions(+), 4 deletions(-) >>> >> _______________________________________________ ffmpeg-devel mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
