avcodec/gsmdec_template: Fix runtime error: signed integer overflow: -22527 * 99113...
[ffmpeg.git] / libavcodec / wavpack.h
index 3a3e8db..a1b46d5 100644 (file)
@@ -53,7 +53,7 @@
 #define WV_FLT_ZERO_SENT  0x08
 #define WV_FLT_ZERO_SIGN  0x10
 
-#define WV_MAX_SAMPLES    131072
+#define WV_MAX_SAMPLES    150000
 
 enum WP_ID_Flags {
     WP_IDF_MASK   = 0x3F,
@@ -104,15 +104,15 @@ typedef struct WvChannel {
 
 // macros for applying weight
 #define UPDATE_WEIGHT_CLIP(weight, delta, samples, in) \
-    if (samples && in) { \
-        if ((samples ^ in) < 0) { \
-            weight -= delta; \
-            if (weight < -1024) \
-                weight = -1024; \
+    if ((samples) && (in)) { \
+        if (((samples) ^ (in)) < 0) { \
+            (weight) -= (delta); \
+            if ((weight) < -1024) \
+                (weight) = -1024; \
         } else { \
-            weight += delta; \
-            if (weight > 1024) \
-                weight = 1024; \
+            (weight) += (delta); \
+            if ((weight) > 1024) \
+                (weight) = 1024; \
         } \
     }