Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Johannes Kauffmann <johanneskauffmann@hotmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] libavformat/fitsdec: use correct type for assert
Date: Wed, 21 Sep 2022 01:55:51 +0200
Message-ID: <DB6PR07MB3175A234E7CFB29DD1125A29A64C9@DB6PR07MB3175.eurprd07.prod.outlook.com> (raw)
In-Reply-To: <DB6PR07MB3175F2F9E1E85521E518F33DA64C9@DB6PR07MB3175.eurprd07.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

Now with correct formatting. Patch attached.

On 21/09/2022 01:22, Johannes Kauffmann wrote:
> 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;

[-- Attachment #2: 0001-libavformat-fitsdec-use-correct-type-for-assert.patch --]
[-- Type: text/plain, Size: 1273 bytes --]

From a615d32204c50ab8a341caafba76b02ffebd2877 Mon Sep 17 00:00:00 2001
From: Johannes Kauffmann <johanneskauffmann@hotmail.com>
Date: Wed, 21 Sep 2022 01:00:23 +0200
Subject: [PATCH] libavformat/fitsdec: use correct type for assert

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


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      reply	other threads:[~2022-09-20 23:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 23:22 Johannes Kauffmann
2022-09-20 23:55 ` Johannes Kauffmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB6PR07MB3175A234E7CFB29DD1125A29A64C9@DB6PR07MB3175.eurprd07.prod.outlook.com \
    --to=johanneskauffmann@hotmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git