aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/evc.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-06-19 17:01:41 -0300
committerJames Almer <jamrial@gmail.com>2023-06-19 17:21:19 -0300
commite81eafcb974f9d7999889dd6c96cf77b07fde08b (patch)
treea46e110bfc02c07aa8f7f33375d3b43efafa029f /libavformat/evc.c
parent048b8bdd5eb4add7ba839b98ed717fe85b890c50 (diff)
downloadffmpeg-e81eafcb974f9d7999889dd6c96cf77b07fde08b.tar.gz
avformat/evc: skip nalu header size bytes before parsing sps
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/evc.c')
-rw-r--r--libavformat/evc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/evc.c b/libavformat/evc.c
index a194da1c39..79463ba018 100644
--- a/libavformat/evc.c
+++ b/libavformat/evc.c
@@ -120,6 +120,9 @@ static int evcc_parse_sps(const uint8_t *bs, int bs_size, EVCDecoderConfiguratio
int sps_seq_parameter_set_id;
EVCSPS sps;
+ bs += EVC_NALU_HEADER_SIZE;
+ bs_size -= EVC_NALU_HEADER_SIZE;
+
if (init_get_bits8(&gb, bs, bs_size) < 0)
return 0;
@@ -368,6 +371,10 @@ int ff_isom_write_evcc(AVIOContext *pb, const uint8_t *data,
if (bytes_to_read < nalu_size) break;
nalu_type = evc_get_nalu_type(data, bytes_to_read, pb);
+ if (nalu_type < EVC_NOIDR_NUT || nalu_type > EVC_UNSPEC_NUT62) {
+ ret = AVERROR_INVALIDDATA;
+ goto end;
+ }
// @see ISO/IEC 14496-15:2021 Coding of audio-visual objects - Part 15: section 12.3.3.3
// NAL_unit_type indicates the type of the NAL units in the following array (which shall be all of that type);