You've already forked FFmpeg
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:
@ -96,9 +96,10 @@ static int tak_read_header(AVFormatContext *s)
|
|||||||
memset(buffer + size - 3, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
memset(buffer + size - 3, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||||
|
|
||||||
ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U);
|
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);
|
av_freep(&buffer);
|
||||||
return AVERROR(EIO);
|
return ret < 0 ? ret : AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
if (ffio_get_checksum(s->pb) != avio_rb24(pb)) {
|
if (ffio_get_checksum(s->pb) != avio_rb24(pb)) {
|
||||||
av_log(s, AV_LOG_ERROR, "%d metadata block CRC error.\n", type);
|
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)
|
if (size != 19)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U);
|
ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U);
|
||||||
if (avio_read(pb, md5, 16) != 16)
|
ret = avio_read(pb, md5, 16);
|
||||||
return AVERROR(EIO);
|
if (ret != 16)
|
||||||
|
return ret < 0 ? ret : AVERROR_INVALIDDATA;
|
||||||
if (ffio_get_checksum(s->pb) != avio_rb24(pb)) {
|
if (ffio_get_checksum(s->pb) != avio_rb24(pb)) {
|
||||||
av_log(s, AV_LOG_ERROR, "MD5 metadata block CRC error.\n");
|
av_log(s, AV_LOG_ERROR, "MD5 metadata block CRC error.\n");
|
||||||
if (s->error_recognition & AV_EF_EXPLODE)
|
if (s->error_recognition & AV_EF_EXPLODE)
|
||||||
|
Reference in New Issue
Block a user