Index: source/libvpx/vpx/src/vpx_image.c |
=================================================================== |
--- source/libvpx/vpx/src/vpx_image.c (revision 284462) |
+++ source/libvpx/vpx/src/vpx_image.c (working copy) |
@@ -12,6 +12,7 @@ |
#include <stdlib.h> |
#include <string.h> |
#include "vpx/vpx_image.h" |
+#include "vpx/vpx_integer.h" |
#define ADDRESS_STORAGE_SIZE sizeof(size_t) |
/*returns an addr aligned to the byte boundary specified by align*/ |
@@ -165,8 +166,13 @@ |
img->img_data = img_data; |
if (!img_data) { |
- img->img_data = img_buf_memalign(buf_align, ((fmt & VPX_IMG_FMT_PLANAR) ? |
- h * s * bps / 8 : h * s)); |
+ const uint64_t alloc_size = (fmt & VPX_IMG_FMT_PLANAR) ? |
+ (uint64_t)h * s * bps / 8 : (uint64_t)h * s; |
+ |
+ if (alloc_size != (size_t)alloc_size) |
+ goto fail; |
+ |
+ img->img_data = img_buf_memalign(buf_align, (size_t)alloc_size); |
img->img_data_owner = 1; |
} |