1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avformat/av1dec: fix return value on some code paths

If avio_read() returns a value of bytes read that's lower than the
expected, return an error instead. And when there are zero bytes in
the prefetch buffer, return 0 in order for the frame merge bsf to
drain all potentially buffered packets.

Missed by mistake when amending and committing 9a7bdb6d71.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-08-14 00:09:43 -03:00
parent 3105e97050
commit a762fd2c1b

View File

@ -411,7 +411,7 @@ static int obu_read_data(AVFormatContext *s, AVPacket *pkt, int len)
ret = avio_read(s->pb, pkt->data + size, left);
if (ret != left) {
av_log(c, AV_LOG_ERROR, "Failed to read %d frome file\n", left);
return ret;
return ret < 0 ? ret : AVERROR_INVALIDDATA;
}
}
return 0;
@ -426,7 +426,7 @@ static int obu_get_packet(AVFormatContext *s, AVPacket *pkt)
ret = obu_prefetch(s, header);
if (!ret)
return AVERROR(EOF);
return 0;
ret = read_obu_with_size(header, ret, &obu_size, &type);
if (ret < 0) {