diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-22 09:54:23 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-27 04:27:09 +0100 |
commit | 963d4b76debd3b7577a8e35fb40662974d52fe28 (patch) | |
tree | 02ed2b6e0233ed9caa1248053b0a45e33527042a | |
parent | e38cbb8d19e21af9ea3f947e64bee1d4d362e492 (diff) | |
download | ffmpeg-963d4b76debd3b7577a8e35fb40662974d52fe28.tar.gz |
avformat/concat: Remove unnecessary check
This code was written when the allocation functions used parameters of
type unsigned. This is no longer true today and therefore we only need
to check whether the multiplication of the array's size stays within
a size_t -- and this can be offloaded to av_realloc_array.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavformat/concat.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libavformat/concat.c b/libavformat/concat.c index 418405dd50..278afd997d 100644 --- a/libavformat/concat.c +++ b/libavformat/concat.c @@ -73,14 +73,11 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags) for (i = 0, len = 1; uri[i]; i++) { if (uri[i] == *AV_CAT_SEPARATOR) { - /* integer overflow */ - if (++len == UINT_MAX / sizeof(*nodes)) { - return AVERROR(ENAMETOOLONG); - } + len++; } } - if (!(nodes = av_realloc(NULL, sizeof(*nodes) * len))) + if (!(nodes = av_realloc_array(NULL, len, sizeof(*nodes)))) return AVERROR(ENOMEM); else data->nodes = nodes; |