From: Soham via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Soham <10er36sohamk@gmail.com>
Subject: [FFmpeg-devel] [PATCH] avcodec/put_bits: fix signed/unsigned buffer size comparisons
Date: Sat, 10 Jan 2026 17:37:28 +0530
Message-ID: <20260110120841.33034-2-10er36sohamk@gmail.com> (raw)
In-Reply-To: <20260110120841.33034-1-10er36sohamk@gmail.com>
---
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
prev parent reply other threads:[~2026-01-10 12:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-10 12:07 Soham via ffmpeg-devel
2026-01-10 12:07 ` Soham via ffmpeg-devel [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=20260110120841.33034-2-10er36sohamk@gmail.com \
--to=ffmpeg-devel@ffmpeg.org \
--cc=10er36sohamk@gmail.com \
/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