summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-01-30 12:35:04 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-01-30 12:36:50 +0200
commitc9b805cacbd329131e8e88df9d11d0e650edf9c1 (patch)
tree635b92afd4d852274d2986b35bc0ffaa598ae132
parente10b20fec14f6265c91056b22417e2a85c878575 (diff)
downloadgstreamer-plugins-base-c9b805cacbd329131e8e88df9d11d0e650edf9c1.tar.gz
audio-resampler: Fix integer overflow in clamping code
https://bugzilla.gnome.org/show_bug.cgi?id=777921
-rw-r--r--gst-libs/gst/audio/audio-resampler-x86-sse41.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gst-libs/gst/audio/audio-resampler-x86-sse41.c b/gst-libs/gst/audio/audio-resampler-x86-sse41.c
index ce1cc2418..a14ca1008 100644
--- a/gst-libs/gst/audio/audio-resampler-x86-sse41.c
+++ b/gst-libs/gst/audio/audio-resampler-x86-sse41.c
@@ -70,7 +70,7 @@ inner_product_gint32_full_1_sse41 (gint32 * o, const gint32 * a,
res = _mm_cvtsi128_si64 (sum);
res = (res + (1 << (PRECISION_S32 - 1))) >> PRECISION_S32;
- *o = CLAMP (res, -(1L << 31), (1L << 31) - 1);
+ *o = CLAMP (res, G_MININT32, G_MAXINT32);
}
static inline void
@@ -113,7 +113,7 @@ inner_product_gint32_linear_1_sse41 (gint32 * o, const gint32 * a,
res = _mm_cvtsi128_si64 (sum[0]);
res = (res + (1 << (PRECISION_S32 - 1))) >> PRECISION_S32;
- *o = CLAMP (res, -(1L << 31), (1L << 31) - 1);
+ *o = CLAMP (res, G_MININT32, G_MAXINT32);
}
static inline void
@@ -178,7 +178,7 @@ inner_product_gint32_cubic_1_sse41 (gint32 * o, const gint32 * a,
res = _mm_cvtsi128_si64 (sum[0]);
res = (res + (1 << (PRECISION_S32 - 1))) >> PRECISION_S32;
- *o = CLAMP (res, -(1L << 31), (1L << 31) - 1);
+ *o = CLAMP (res, G_MININT32, G_MAXINT32);
}
MAKE_RESAMPLE_FUNC (gint32, full, 1, sse41);