[FFmpeg-devel] [PATCH] libavformat/fitsdec: use correct type for assert

Johannes Kauffmann johanneskauffmann at hotmail.com
Wed Sep 21 02:22:21 EEST 2022


Since avbuf.len is of type unsigned and not int64_t, compare to UINT_MAX
instead of INT64_MAX.

This fixes the following warning on clang:

src/libavformat/fitsdec.c:177:26: warning: result of comparison of
constant 9223372036854775807 with expression of type 'unsigned int' is
always true [-Wtautological-constant-out-of-range-compare]

     av_assert0(avbuf.len <= INT64_MAX && size <= INT64_MAX);
     ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
  libavformat/fitsdec.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/fitsdec.c b/libavformat/fitsdec.c
index 54412c60ff..b2ef826f52 100644
--- a/libavformat/fitsdec.c
+++ b/libavformat/fitsdec.c
@@ -174,7 +174,7 @@ static int fits_read_packet(AVFormatContext *s, 
AVPacket *pkt)
          goto fail;
      }
  -    av_assert0(avbuf.len <= INT64_MAX && size <= INT64_MAX);
+    av_assert0(avbuf.len <= UINT_MAX && size <= INT64_MAX);
      if (avbuf.len + size > INT_MAX - 80)  {
          ret = AVERROR_INVALIDDATA;
          goto fail;
-- 
2.34.1



More information about the ffmpeg-devel mailing list