[FFmpeg-cvslog] avformat/takdec.c: return proper error codes for avio_read() failures
James Almer
git at videolan.org
Mon Apr 21 20:09:05 EEST 2025
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Apr 21 14:06:41 2025 -0300| [b6c2498a5902766f924cc8728ac65d4fbfd95238] | committer: James Almer
avformat/takdec.c: return proper error codes for avio_read() failures
Suggested-by: Nicolas George <george at nsup.org>
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b6c2498a5902766f924cc8728ac65d4fbfd95238
---
libavformat/takdec.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavformat/takdec.c b/libavformat/takdec.c
index 01bb16ea7b..e6de269b05 100644
--- a/libavformat/takdec.c
+++ b/libavformat/takdec.c
@@ -96,9 +96,10 @@ static int tak_read_header(AVFormatContext *s)
memset(buffer + size - 3, 0, AV_INPUT_BUFFER_PADDING_SIZE);
ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U);
- if (avio_read(pb, buffer, size - 3) != size - 3) {
+ ret = avio_read(pb, buffer, size - 3);
+ if (ret != size - 3) {
av_freep(&buffer);
- return AVERROR(EIO);
+ return ret < 0 ? ret : AVERROR_INVALIDDATA;
}
if (ffio_get_checksum(s->pb) != avio_rb24(pb)) {
av_log(s, AV_LOG_ERROR, "%d metadata block CRC error.\n", type);
@@ -116,8 +117,9 @@ static int tak_read_header(AVFormatContext *s)
if (size != 19)
return AVERROR_INVALIDDATA;
ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U);
- if (avio_read(pb, md5, 16) != 16)
- return AVERROR(EIO);
+ ret = avio_read(pb, md5, 16);
+ if (ret != 16)
+ return ret < 0 ? ret : AVERROR_INVALIDDATA;
if (ffio_get_checksum(s->pb) != avio_rb24(pb)) {
av_log(s, AV_LOG_ERROR, "MD5 metadata block CRC error.\n");
if (s->error_recognition & AV_EF_EXPLODE)
More information about the ffmpeg-cvslog
mailing list