Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/put_bits: fix signed/unsigned buffer size comparisons
@ 2026-01-10 12:07 Soham via ffmpeg-devel
  2026-01-10 12:07 ` Soham via ffmpeg-devel
  0 siblings, 1 reply; 2+ messages in thread
From: Soham via ffmpeg-devel @ 2026-01-10 12:07 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Soham


Hi,

This patch fixes -Wsign-compare warnings in put_bits.h by casting
buffer size differences to size_t before comparing with sizeof().

No functional changes intended.

Thanks,
Soham
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [FFmpeg-devel] [PATCH] avcodec/put_bits: fix signed/unsigned buffer size comparisons
  2026-01-10 12:07 [FFmpeg-devel] [PATCH] avcodec/put_bits: fix signed/unsigned buffer size comparisons Soham via ffmpeg-devel
@ 2026-01-10 12:07 ` Soham via ffmpeg-devel
  0 siblings, 0 replies; 2+ messages in thread
From: Soham via ffmpeg-devel @ 2026-01-10 12:07 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Soham

---
 libavcodec/put_bits.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index 98c0d7e51f..a1b38cee40 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -216,7 +216,7 @@ static inline void put_bits_no_assert(PutBitContext *s, int n, BitBuf value)
 #ifdef BITSTREAM_WRITER_LE
     bit_buf |= value << (BUF_BITS - bit_left);
     if (n >= bit_left) {
-        if (s->buf_end - s->buf_ptr >= sizeof(BitBuf)) {
+        if ((size_t)(s->buf_end - s->buf_ptr) >= sizeof(BitBuf)) {
             AV_WLBUF(s->buf_ptr, bit_buf);
             s->buf_ptr += sizeof(BitBuf);
         } else {
@@ -234,7 +234,7 @@ static inline void put_bits_no_assert(PutBitContext *s, int n, BitBuf value)
     } else {
         bit_buf   <<= bit_left;
         bit_buf    |= value >> (n - bit_left);
-        if (s->buf_end - s->buf_ptr >= sizeof(BitBuf)) {
+	if ((size_t)(s->buf_end - s->buf_ptr) >= sizeof(BitBuf)) {
             AV_WBBUF(s->buf_ptr, bit_buf);
             s->buf_ptr += sizeof(BitBuf);
         } else {
@@ -272,7 +272,7 @@ static inline void put_bits_le(PutBitContext *s, int n, BitBuf value)
 
     bit_buf |= value << (BUF_BITS - bit_left);
     if (n >= bit_left) {
-        if (s->buf_end - s->buf_ptr >= sizeof(BitBuf)) {
+        if ((size_t)(s->buf_end - s->buf_ptr) >= sizeof(BitBuf)) {
             AV_WLBUF(s->buf_ptr, bit_buf);
             s->buf_ptr += sizeof(BitBuf);
         } else {
@@ -313,7 +313,7 @@ av_unused static void put_bits32(PutBitContext *s, uint32_t value)
 
 #ifdef BITSTREAM_WRITER_LE
     bit_buf |= (BitBuf)value << (BUF_BITS - bit_left);
-    if (s->buf_end - s->buf_ptr >= sizeof(BitBuf)) {
+    if ((size_t)(s->buf_end - s->buf_ptr) >= sizeof(BitBuf)) {
         AV_WLBUF(s->buf_ptr, bit_buf);
         s->buf_ptr += sizeof(BitBuf);
     } else {
@@ -324,7 +324,7 @@ av_unused static void put_bits32(PutBitContext *s, uint32_t value)
 #else
     bit_buf     = (uint64_t)bit_buf << bit_left;
     bit_buf    |= (BitBuf)value >> (BUF_BITS - bit_left);
-    if (s->buf_end - s->buf_ptr >= sizeof(BitBuf)) {
+    if ((size_t)(s->buf_end - s->buf_ptr) >= sizeof(BitBuf)) {
         AV_WBBUF(s->buf_ptr, bit_buf);
         s->buf_ptr += sizeof(BitBuf);
     } else {
-- 
2.47.3

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-10 12:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-10 12:07 [FFmpeg-devel] [PATCH] avcodec/put_bits: fix signed/unsigned buffer size comparisons Soham via ffmpeg-devel
2026-01-10 12:07 ` Soham via ffmpeg-devel

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