1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avformat/takdec.c: return proper error codes for avio_read() failures

Suggested-by: Nicolas George <george@nsup.org>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2025-04-21 14:06:41 -03:00
parent 1d244c641b
commit b6c2498a59

View File

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