diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-02-20 19:34:54 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-16 16:00:21 +0200 |
commit | 2015c109ac93a104c9ee4d9ce7ba3ef39b76d935 (patch) | |
tree | cef2aa361eb9e10297315df534b2e0d8b6715150 | |
parent | 38c7a1ef5cb0a18e48b8a6a12687c7f679b01094 (diff) | |
download | ffmpeg-2015c109ac93a104c9ee4d9ce7ba3ef39b76d935.tar.gz |
Add CHECK/SUINT code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4614bf2caf67a89c2d833b3368f325eab54582bc)
(cherry picked from commit e8d4eacc07c61ae24f48451073a2620d8d257d33)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3f2a09a43f6fade53227804459e6babb1c7248b3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavutil/internal.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h index 61784b5128..cc2d97dc52 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -30,6 +30,10 @@ # define NDEBUG #endif +#if defined(DEBUG) && !defined(CHECKED) +# define CHECKED +#endif + #include <limits.h> #include <stdint.h> #include <stddef.h> @@ -258,6 +262,16 @@ void avpriv_request_sample(void *avc, # define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) #endif +// 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 + /** * Clip and convert a double value into the long long amin-amax range. * This function is needed because conversion of floating point to integers when |