aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-06-19 23:25:43 -0300
committerJames Almer <jamrial@gmail.com>2023-06-21 13:31:14 -0300
commit2276bcc52acf224da38eadb8068a8535260678e0 (patch)
treec27977cec79c084fecd15ffeee7452b3c9dfffc0
parent83b3ff741be6d7c0c4b10bedaada7a329b96f22b (diff)
downloadffmpeg-2276bcc52acf224da38eadb8068a8535260678e0.tar.gz
avformat/evcdec: ensure there are enough bytes to seekback
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/evcdec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/evcdec.c b/libavformat/evcdec.c
index 890babd3cb..9c4969e78f 100644
--- a/libavformat/evcdec.c
+++ b/libavformat/evcdec.c
@@ -30,6 +30,7 @@
#include "rawdec.h"
#include "avformat.h"
+#include "avio_internal.h"
#include "internal.h"
@@ -192,8 +193,12 @@ static int evc_read_packet(AVFormatContext *s, AVPacket *pkt)
}
while(!au_end_found) {
-
uint8_t buf[EVC_NALU_LENGTH_PREFIX_SIZE];
+
+ ret = ffio_ensure_seekback(s->pb, EVC_NALU_LENGTH_PREFIX_SIZE);
+ if (ret < 0)
+ return ret;
+
ret = avio_read(s->pb, (unsigned char *)&buf, EVC_NALU_LENGTH_PREFIX_SIZE);
if (ret < 0) {
av_packet_unref(pkt);