diff mbox series

[FFmpeg-devel,4/4] avformat/rtpenc_rfc4175: Use 64bit in computation if copy_offset

Message ID 20240607231803.3017607-4-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/4] avformat/rmdec: use 64bit for audio_framesize checks | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer June 7, 2024, 11:18 p.m. UTC
Found while reviewing: CID1494441 Untrusted value as argument

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/rtpenc_rfc4175.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/rtpenc_rfc4175.c b/libavformat/rtpenc_rfc4175.c
index 257d072cd31..2120274f014 100644
--- a/libavformat/rtpenc_rfc4175.c
+++ b/libavformat/rtpenc_rfc4175.c
@@ -116,7 +116,7 @@  void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size,
             int l_field;
             int l_line;
             int l_off;
-            int copy_offset;
+            int64_t copy_offset;
 
             length    = (headers[0] << 8) | headers[1];
             l_field   = (headers[2] & 0x80) >> 7;
@@ -127,7 +127,7 @@  void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size,
 
             if (interlaced)
                 l_line = 2 * l_line + l_field;
-            copy_offset = (l_line * width + l_off) * pgroup / xinc;
+            copy_offset = (l_line * (int64_t)width + l_off) * pgroup / xinc;
             if (copy_offset + length > size)
                 break;
             memcpy (dest, buf + copy_offset, length);