summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/opj_includes.h
diff options
context:
space:
mode:
authorMatthieu Darbois <mayeut@users.noreply.github.com>2016-04-28 13:16:43 +0200
committerMatthieu Darbois <mayeut@users.noreply.github.com>2016-04-28 13:16:43 +0200
commit29313eb5f1b2c01c7493087fa2d8f1a20495a34e (patch)
tree8692044fc432188990ac74aa0aef440321cbb12d /src/lib/openjp2/opj_includes.h
parente982d0396607a16ca0c373020cc93449504eb4e8 (diff)
Fix unsigned int overflow reported by UBSan (#761)
* Fix unsigned int overflow reported by UBSan Please add -DOPJ_UBSAN_BUILD to CFLAGS when building with -fsanitize=undefined,unsigned-integer-overflow It seems clang/gcc do not allow to disable checking for block of code other than function or file.
Diffstat (limited to 'src/lib/openjp2/opj_includes.h')
-rw-r--r--src/lib/openjp2/opj_includes.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/openjp2/opj_includes.h b/src/lib/openjp2/opj_includes.h
index 5add0918..58a5a9a9 100644
--- a/src/lib/openjp2/opj_includes.h
+++ b/src/lib/openjp2/opj_includes.h
@@ -112,6 +112,14 @@
#endif
#endif
+#ifdef __has_attribute
+ #if __has_attribute(no_sanitize)
+ #define OPJ_NOSANITIZE(kind) __attribute__((no_sanitize(kind)))
+ #endif
+#endif
+#ifndef OPJ_NOSANITIZE
+ #define OPJ_NOSANITIZE(kind)
+#endif
/* MSVC before 2013 and Borland C do not have lrintf */