aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/flacdsp.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-02-19 14:34:55 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-19 15:58:30 +0100
commit3e1028c625e11d9d19376f5c88267de1cee8fa70 (patch)
tree687d71ab3c35a2771450ced8c03724dc39c91d5c /libavcodec/flacdsp.h
parente8d4eacc07c61ae24f48451073a2620d8d257d33 (diff)
downloadffmpeg-3e1028c625e11d9d19376f5c88267de1cee8fa70.tar.gz
avcodec/flac: Fix several integer overflows
Fixes: 686513-media Found-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/flacdsp.h')
-rw-r--r--libavcodec/flacdsp.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/flacdsp.h b/libavcodec/flacdsp.h
index f5cbd94724..31417f8414 100644
--- a/libavcodec/flacdsp.h
+++ b/libavcodec/flacdsp.h
@@ -20,8 +20,19 @@
#define AVCODEC_FLACDSP_H
#include <stdint.h>
+#include "libavutil/internal.h"
#include "libavutil/samplefmt.h"
+// For debuging we use signed operations so overflows can be detected (by ubsan)
+// For production we use unsigned so there are no undefined operations
+#ifdef CHECKED
+#define SUINT int
+#define SUINT32 int32_t
+#else
+#define SUINT unsigned
+#define SUINT32 uint32_t
+#endif
+
typedef struct FLACDSPContext {
void (*decorrelate[4])(uint8_t **out, int32_t **in, int channels,
int len, int shift);