1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/rtpenc_rfc4175: Use 64bit in computation if copy_offset

Found while reviewing: CID1494441 Untrusted value as argument

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f13ae63259)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-06-08 00:13:59 +02:00
parent f6b059008f
commit b92c0e54fc
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -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);