summaryrefslogtreecommitdiff
path: root/libavcodec/dct32_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-02-20 13:42:33 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-20 17:14:54 +0100
commit15ccaa344c4f645ae791aafecdef3d886e196127 (patch)
treecce386ede739cc96e0c5f9109cb8ad4af8e6f3a8 /libavcodec/dct32_template.c
parent01d196a67dc55eb01cf3e06d6338c5d096a29b1c (diff)
avcodec/mpegaudiodec: Eliminate many undefined operations
Fixes: 625/clusterfuzz-testcase-4574924406521856 Fixes: 626/clusterfuzz-testcase-4738718621499392 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dct32_template.c')
-rw-r--r--libavcodec/dct32_template.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavcodec/dct32_template.c b/libavcodec/dct32_template.c
index c70396e5f5..bb3f1553ac 100644
--- a/libavcodec/dct32_template.c
+++ b/libavcodec/dct32_template.c
@@ -21,17 +21,28 @@
#include "dct32.h"
#include "mathops.h"
+#include "libavutil/internal.h"
+
+#ifdef CHECKED
+#define SUINT int
+#define SUINT32 int32_t
+#else
+#define SUINT unsigned
+#define SUINT32 uint32_t
+#endif
#if DCT32_FLOAT
# define dct32 ff_dct32_float
# define FIXHR(x) ((float)(x))
# define MULH3(x, y, s) ((s)*(y)*(x))
# define INTFLOAT float
+# define SUINTFLOAT float
#else
# define dct32 ff_dct32_fixed
# define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5))
# define MULH3(x, y, s) MULH((s)*(x), y)
# define INTFLOAT int
+# define SUINTFLOAT SUINT
#endif
@@ -114,9 +125,9 @@
/* DCT32 without 1/sqrt(2) coef zero scaling. */
void dct32(INTFLOAT *out, const INTFLOAT *tab)
{
- INTFLOAT tmp0, tmp1;
+ SUINTFLOAT tmp0, tmp1;
- INTFLOAT val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7 ,
+ SUINTFLOAT val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7 ,
val8 , val9 , val10, val11, val12, val13, val14, val15,
val16, val17, val18, val19, val20, val21, val22, val23,
val24, val25, val26, val27, val28, val29, val30, val31;