summaryrefslogtreecommitdiff
path: root/libavformat/evcdec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-06-19 23:47:07 -0300
committerJames Almer <jamrial@gmail.com>2023-06-21 13:31:14 -0300
commitd0d20f16ce4de0d814b7dac28fa18c666b7a8a85 (patch)
treebcf6b2c4d90285572cd83e69daeb653b2169eabb /libavformat/evcdec.c
parenta6a5e5359573aab7a0dd19045ceafe5149dffd87 (diff)
avformat/evcdec: use an unsigned type for nalu_size
But ensure the value returned by evc_read_nal_unit_length() fits in an int. Should prevent integer overflows later in the code. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/evcdec.c')
-rw-r--r--libavformat/evcdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/evcdec.c b/libavformat/evcdec.c
index 842258d229..ef743028ae 100644
--- a/libavformat/evcdec.c
+++ b/libavformat/evcdec.c
@@ -181,7 +181,7 @@ fail:
static int evc_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret;
- int32_t nalu_size;
+ uint32_t nalu_size;
int au_end_found = 0;
EVCDemuxContext *const c = s->priv_data;
@@ -200,7 +200,7 @@ static int evc_read_packet(AVFormatContext *s, AVPacket *pkt)
return ret;
nalu_size = read_nal_unit_length((const uint8_t *)&buf, EVC_NALU_LENGTH_PREFIX_SIZE);
- if (nalu_size <= 0)
+ if (!nalu_size || nalu_size > INT_MAX)
return AVERROR_INVALIDDATA;
avio_seek(s->pb, -EVC_NALU_LENGTH_PREFIX_SIZE, SEEK_CUR);