shithub: libvpx

Download patch

ref: 7a63240c485cd702bead191f36f9bf03d193e7c5
parent: eeaf70361d443161d0a0bcdb57d5adcddb819ec6
parent: f33f2fc686c5a248765211f570bca1dfa6a8c44b
author: James Zern <jzern@google.com>
date: Thu Jan 23 17:53:25 EST 2020

Merge "vpx_timestamp,gcd: assert params are positive"

--- a/vpx_util/vpx_timestamp.h
+++ b/vpx_util/vpx_timestamp.h
@@ -11,6 +11,8 @@
 #ifndef VPX_VPX_UTIL_VPX_TIMESTAMP_H_
 #define VPX_VPX_UTIL_VPX_TIMESTAMP_H_
 
+#include <assert.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif  // __cplusplus
@@ -23,7 +25,9 @@
 
 static INLINE int gcd(int64_t a, int b) {
   int r;  // remainder
-  while (b > 0) {
+  assert(a >= 0);
+  assert(b > 0);
+  while (b != 0) {
     r = (int)(a % b);
     a = b;
     b = r;