* [FFmpeg-devel] [PATCH] libavformat/fitsdec: use correct type for assert
@ 2022-09-20 23:22 Johannes Kauffmann
2022-09-20 23:55 ` Johannes Kauffmann
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Kauffmann @ 2022-09-20 23:22 UTC (permalink / raw)
To: ffmpeg-devel
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
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavformat/fitsdec: use correct type for assert
2022-09-20 23:22 [FFmpeg-devel] [PATCH] libavformat/fitsdec: use correct type for assert Johannes Kauffmann
@ 2022-09-20 23:55 ` Johannes Kauffmann
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Kauffmann @ 2022-09-20 23:55 UTC (permalink / raw)
To: ffmpeg-devel
[-- 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".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-20 23:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 23:22 [FFmpeg-devel] [PATCH] libavformat/fitsdec: use correct type for assert Johannes Kauffmann
2022-09-20 23:55 ` Johannes Kauffmann
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