Browse Source

Merge commit '94a417acc05cc5151b473abc0bf51fad26f8c5a0'

* commit '94a417acc05cc5151b473abc0bf51fad26f8c5a0':
  mathematics: remove asserts from av_rescale_rnd()

Conflicts:
	libavutil/mathematics.c

The asserts are left in place for now as no code checks the return
value, but we sure can change this if application developers
prefer

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer 11 years ago
parent
commit
3929c17405
1 changed files with 3 additions and 0 deletions
  1. 3 0
      libavutil/mathematics.c

+ 3 - 0
libavutil/mathematics.c

@@ -63,6 +63,9 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){
     av_assert2(b >=0);
     av_assert2((unsigned)(rnd&~AV_ROUND_PASS_MINMAX)<=5 && (rnd&~AV_ROUND_PASS_MINMAX)!=4);
 
+    if (c <= 0 || b < 0 || !((unsigned)(rnd&~AV_ROUND_PASS_MINMAX)<=5 && (rnd&~AV_ROUND_PASS_MINMAX)!=4))
+        return INT64_MIN;
+
     if (rnd & AV_ROUND_PASS_MINMAX) {
         if (a == INT64_MIN || a == INT64_MAX)
             return a;