mirror of https://git.ffmpeg.org/ffmpeg.git
Add CHECK/SUINT code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit4614bf2caf
) (cherry picked from commite8d4eacc07
) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 3f2a09a43f6fade53227804459e6babb1c7248b3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
570826b632
commit
6ab9a98908
|
@ -30,6 +30,10 @@
|
|||
# define NDEBUG
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG) && !defined(CHECKED)
|
||||
# define CHECKED
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
@ -252,6 +256,17 @@ void avpriv_request_sample(void *avc,
|
|||
#define SIZE_SPECIFIER "zu"
|
||||
#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
|
||||
|
||||
/**
|
||||
* A wrapper for open() setting O_CLOEXEC.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue