diff mbox series

[FFmpeg-devel,3/3] avformat: use AV_PKT_MAX_PAYLOAD_SIZE

Message ID 20230621204658.2742-3-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/3] avcodec/packet: add a define for the max buffer size a packet can hold | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer June 21, 2023, 8:46 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/4xm.c          | 2 +-
 libavformat/flac_picture.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index fdf6e4b84b..1a35299254 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -328,7 +328,7 @@  static int fourxm_read_packet(AVFormatContext *s,
         case cfr2_TAG:
             /* allocate 8 more bytes than 'size' to account for fourcc
              * and size */
-            if (size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - 8)
+            if (size > AV_PKT_MAX_PAYLOAD_SIZE - 8)
                 return AVERROR_INVALIDDATA;
             if (fourxm->video_stream_index < 0)
                 return AVERROR_INVALIDDATA;
diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
index b33fee75b4..16a053c6ea 100644
--- a/libavformat/flac_picture.c
+++ b/libavformat/flac_picture.c
@@ -120,7 +120,7 @@  int ff_flac_parse_picture(AVFormatContext *s, uint8_t **bufp, int buf_size,
 
     left = bytestream2_get_bytes_left(&g);
     if (len <= 0 || len > left) {
-        if (len > MAX_TRUNC_PICTURE_SIZE || len >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
+        if (len > MAX_TRUNC_PICTURE_SIZE || len >= AV_PKT_MAX_PAYLOAD_SIZE) {
             av_log(s, AV_LOG_ERROR, "Attached picture metadata block too big %u\n", len);
             if (s->error_recognition & AV_EF_EXPLODE)
                 return AVERROR_INVALIDDATA;