summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/movtextenc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index 1bef21e0b9..cf30adbd0a 100644
--- a/libavcodec/movtextenc.c
+++ b/libavcodec/movtextenc.c
@@ -355,7 +355,7 @@ static int mov_text_style_start(MovTextContext *s)
StyleBox *tmp;
// last style != defaults, end the style entry and start a new one
- if (s->count + 1 > SIZE_MAX / sizeof(*s->style_attributes) ||
+ if (s->count + 1 > FFMIN(SIZE_MAX / sizeof(*s->style_attributes), UINT16_MAX) ||
!(tmp = av_fast_realloc(s->style_attributes,
&s->style_attributes_bytes_allocated,
(s->count + 1) * sizeof(*s->style_attributes)))) {