summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libavcodec/h2645_parse.c6
-rw-r--r--libavcodec/h2645_parse.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index ef6a6b4..b1dba3d 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -455,8 +455,12 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
if (pkt->nals_allocated < pkt->nb_nals + 1) {
int new_size = pkt->nals_allocated + 1;
- void *tmp = av_realloc_array(pkt->nals, new_size, sizeof(*pkt->nals));
+ void *tmp;
+ if (new_size >= INT_MAX / sizeof(*pkt->nals))
+ return AVERROR(ENOMEM);
+
+ tmp = av_fast_realloc(pkt->nals, &pkt->nal_buffer_size, new_size * sizeof(*pkt->nals));
if (!tmp)
return AVERROR(ENOMEM);
diff --git a/libavcodec/h2645_parse.h b/libavcodec/h2645_parse.h
index 2c29ca5..2acf882 100644
--- a/libavcodec/h2645_parse.h
+++ b/libavcodec/h2645_parse.h
@@ -78,6 +78,7 @@ typedef struct H2645Packet {
H2645RBSP rbsp;
int nb_nals;
int nals_allocated;
+ unsigned nal_buffer_size;
} H2645Packet;
/**
OpenPOWER on IntegriCloud