summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/libavutil/mem.c
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-09-30 10:40:30 -0500
committertrav90 <travawine@palemoon.org>2018-09-30 10:40:30 -0500
commitedc124b92beccd55e5277062e95efb62a8b3ec7b (patch)
tree3486b32f85152ff76b1bee03a8d84b3c34c70a5f /media/ffvpx/libavutil/mem.c
parent8ba6dd1bd12a3d13f9e2c683216dd8778011a72e (diff)
downloadUXP-edc124b92beccd55e5277062e95efb62a8b3ec7b.tar
UXP-edc124b92beccd55e5277062e95efb62a8b3ec7b.tar.gz
UXP-edc124b92beccd55e5277062e95efb62a8b3ec7b.tar.lz
UXP-edc124b92beccd55e5277062e95efb62a8b3ec7b.tar.xz
UXP-edc124b92beccd55e5277062e95efb62a8b3ec7b.zip
[ffvpx] Update ffvp9/ffvp8 to release 4.0.2
Diffstat (limited to 'media/ffvpx/libavutil/mem.c')
-rw-r--r--media/ffvpx/libavutil/mem.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/media/ffvpx/libavutil/mem.c b/media/ffvpx/libavutil/mem.c
index 36740f115..6149755a6 100644
--- a/media/ffvpx/libavutil/mem.c
+++ b/media/ffvpx/libavutil/mem.c
@@ -61,7 +61,7 @@ void free(void *ptr);
#include "mem_internal.h"
-#define ALIGN (HAVE_AVX ? 32 : 16)
+#define ALIGN (HAVE_AVX512 ? 64 : (HAVE_AVX ? 32 : 16))
/* NOTE: if you want to override these functions with your own
* implementations (not recommended) you have to link libav* as
@@ -181,6 +181,20 @@ int av_reallocp(void *ptr, size_t size)
return 0;
}
+void *av_malloc_array(size_t nmemb, size_t size)
+{
+ if (!size || nmemb >= INT_MAX / size)
+ return NULL;
+ return av_malloc(nmemb * size);
+}
+
+void *av_mallocz_array(size_t nmemb, size_t size)
+{
+ if (!size || nmemb >= INT_MAX / size)
+ return NULL;
+ return av_mallocz(nmemb * size);
+}
+
void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
{
if (!size || nmemb >= INT_MAX / size)
@@ -449,10 +463,15 @@ void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{
- if (min_size < *size)
+ if (min_size <= *size)
return ptr;
- min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
+ if (min_size > max_alloc_size - 32) {
+ *size = 0;
+ return NULL;
+ }
+
+ min_size = FFMIN(max_alloc_size - 32, FFMAX(min_size + min_size / 16 + 32, min_size));
ptr = av_realloc(ptr, min_size);
/* we could set this to the unmodified min_size but this is safer