[FFmpeg-devel] [PATCH 1/7] avutil: add FF_BAIL_ON_OVERFLOW

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Fri Dec 16 04:32:07 EET 2016


Suggested-by: Rodger Combs <rodger.combs at gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavutil/common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/common.h b/libavutil/common.h
index 8142b31..00b7504 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -99,6 +99,8 @@
 #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
 #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
 
+#define FF_BAIL_ON_OVERFLOW(ctx, x) if (x) {av_log(ctx, AV_LOG_ERROR, "Overflow check failed: " #x"\n"); return AVERROR_INVALIDDATA;}
+
 /* misc math functions */
 
 #ifdef HAVE_AV_CONFIG_H
-- 
2.10.2


More information about the ffmpeg-devel mailing list