[FFmpeg-devel] [PATCH 3/7] avfilter/formats: Resize potentially oversized arrays
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Sat Aug 15 08:48:12 EEST 2020
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavfilter/formats.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index c370f7f91c..4efbcbebfe 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -60,6 +60,7 @@ do { \
#define MERGE_FORMATS(a, b, fmts, nb, type, fail_statement) \
do { \
int i, j, k = 0; \
+ void *tmp; \
\
for (i = 0; i < a->nb; i++) \
for (j = 0; j < b->nb; j++) \
@@ -72,6 +73,9 @@ do {
if (!k) \
{ fail_statement } \
a->nb = k; \
+ tmp = av_realloc_array(a->fmts, a->nb, sizeof(*a->fmts)); \
+ if (tmp) \
+ a->fmts = tmp; \
\
MERGE_REF(a, b, fmts, type, fail_statement); \
} while (0)
--
2.20.1
More information about the ffmpeg-devel
mailing list