aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/av1dec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2020-08-14 00:09:43 -0300
committerJames Almer <jamrial@gmail.com>2020-08-14 00:14:37 -0300
commita762fd2c1b7fe4f0140ed297321b307f9527f929 (patch)
tree66fe639f18b04f5d0a5c414302907d5611d6f998 /libavformat/av1dec.c
parent3105e970503e77f11a9d8139d38b73abe25907a9 (diff)
downloadffmpeg-a762fd2c1b7fe4f0140ed297321b307f9527f929.tar.gz
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>
Diffstat (limited to 'libavformat/av1dec.c')
-rw-r--r--libavformat/av1dec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
index ee5b0fd0fc..0693e40ac1 100644
--- a/libavformat/av1dec.c
+++ b/libavformat/av1dec.c
@@ -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) {