[FFmpeg-cvslog] tools/coverity: Phase 1 study of anti-halicogenic for coverity av_rescale()

Michael Niedermayer git at videolan.org
Mon Jul 8 00:39:36 EEST 2024


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Jul  1 23:18:47 2024 +0200| [380a8213b165d1fda419c566241d2641cb6f5c3c] | committer: Michael Niedermayer

tools/coverity: Phase 1 study of anti-halicogenic for coverity av_rescale()

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=380a8213b165d1fda419c566241d2641cb6f5c3c
---

 tools/coverity.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/coverity.c b/tools/coverity.c
index 19a132a976..541e108238 100644
--- a/tools/coverity.c
+++ b/tools/coverity.c
@@ -31,6 +31,17 @@
 
 #define NULL (void *)0
 
+typedef long long int64_t;
+
+enum AVRounding {
+    AV_ROUND_ZERO     = 0,
+    AV_ROUND_INF      = 1,
+    AV_ROUND_DOWN     = 2,
+    AV_ROUND_UP       = 3,
+    AV_ROUND_NEAR_INF = 5,
+    AV_ROUND_PASS_MINMAX = 8192,
+};
+
 // Based on https://scan.coverity.com/models
 void *av_malloc(size_t size) {
     int has_memory;
@@ -77,3 +88,10 @@ void *av_free(void *ptr) {
     __coverity_mark_as_afm_freed__(ptr, "av_free");
 }
 
+
+int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) {
+    __coverity_negative_sink__(b);
+    __coverity_negative_sink__(c);
+
+    return (double)a * (double)b / (double)c;
+}



More information about the ffmpeg-cvslog mailing list