summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <[email protected]>2025-04-21 14:06:41 -0300
committerJames Almer <[email protected]>2025-04-21 14:08:23 -0300
commitb6c2498a5902766f924cc8728ac65d4fbfd95238 (patch)
tree096bdeec4515d52a01dca99e9038d545f9b8967f
parent1d244c641baf6f11d8c3a61c418c760d628fc548 (diff)
avformat/takdec.c: return proper error codes for avio_read() failures
Suggested-by: Nicolas George <[email protected]> Signed-off-by: James Almer <[email protected]>
-rw-r--r--libavformat/takdec.c10
1 files 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)