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>
This commit is contained in:
Andreas Rheinhardt 2023-07-06 22:48:55 +02:00
parent 0056d9f176
commit e5ab2dab2c
1 changed files with 2 additions and 0 deletions

View File

@ -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)