[FFmpeg-cvslog] avformat/id3v2: check the return value of avio_close_dyn_buf()
James Almer
git at videolan.org
Fri Jun 23 03:00:56 EEST 2023
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Jun 20 17:25:58 2023 -0300| [25ce1c8333337ca27cd0ca54da2179f122a0dc83] | committer: James Almer
avformat/id3v2: check the return value of avio_close_dyn_buf()
Fixes ticket #10424.
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=25ce1c8333337ca27cd0ca54da2179f122a0dc83
---
libavformat/id3v2.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index cb31864045..38c86a8e79 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -246,7 +246,7 @@ static int decode_str(AVFormatContext *s, AVIOContext *pb, int encoding,
int ret;
uint8_t tmp;
uint32_t ch = 1;
- int left = *maxread;
+ int left = *maxread, dynsize;
unsigned int (*get)(AVIOContext*) = avio_rb16;
AVIOContext *dynbuf;
@@ -308,7 +308,9 @@ static int decode_str(AVFormatContext *s, AVIOContext *pb, int encoding,
if (ch)
avio_w8(dynbuf, 0);
- avio_close_dyn_buf(dynbuf, dst);
+ dynsize = avio_close_dyn_buf(dynbuf, dst);
+ if (dynsize <= 0)
+ return AVERROR(ENOMEM);
*maxread = left;
return 0;
More information about the ffmpeg-cvslog
mailing list