summaryrefslogtreecommitdiff
path: root/libavformat/evcdec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-07-06 22:48:55 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-07-09 02:40:14 +0200
commite5ab2dab2c73710c753bf8a44171fc747625e9f3 (patch)
treedd45671a7a4f413839919726984e39be06ccf2a0 /libavformat/evcdec.c
parent0056d9f1765dc1ef0dcb81c6919de7e75575a889 (diff)
avformat/evcdec: Check that enough data has been read
Fixes potential use of uninitialized values in evc_read_nal_unit_length(). Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/evcdec.c')
-rw-r--r--libavformat/evcdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/evcdec.c b/libavformat/evcdec.c
index 9e09f8d264..6cce174f46 100644
--- a/libavformat/evcdec.c
+++ b/libavformat/evcdec.c
@@ -162,6 +162,8 @@ static int evc_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, buf, EVC_NALU_LENGTH_PREFIX_SIZE);
if (ret < 0)
return ret;
+ if (ret != EVC_NALU_LENGTH_PREFIX_SIZE)
+ return AVERROR_INVALIDDATA;
nalu_size = evc_read_nal_unit_length(buf, EVC_NALU_LENGTH_PREFIX_SIZE);
if (!nalu_size || nalu_size > INT_MAX)