summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGwan-gyeong Mun <elongbug@gmail.com>2016-11-20 20:44:22 +0900
committerEmil Velikov <emil.l.velikov@gmail.com>2016-11-24 16:34:42 +0000
commita39e535d6c508635d0f9a328ed91a54ce00a6476 (patch)
tree6b7dfcd127e1f1d292e4fe077cd0cc087dece5b6
parentc19a3311398bdb6a2fd408f017f16a73ad8a801c (diff)
downloadexternal_mesa3d-a39e535d6c508635d0f9a328ed91a54ce00a6476.zip
external_mesa3d-a39e535d6c508635d0f9a328ed91a54ce00a6476.tar.gz
external_mesa3d-a39e535d6c508635d0f9a328ed91a54ce00a6476.tar.bz2
anv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL
Since both pCreateInfo->strideInBytes and pCreateInfo->extent.height are of uint32_t type 32-bit arithmetic will be used. Fix unintentional integer overflow by casting to uint64_t before multifying. CID 1394321 Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com> [Emil Velikov: cast only of the arguments] Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commit e074a08a6ded3260f13111d0e23961dea2da2442)
-rw-r--r--src/intel/vulkan/anv_intel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_intel.c b/src/intel/vulkan/anv_intel.c
index 1c50e2b..c356e84 100644
--- a/src/intel/vulkan/anv_intel.c
+++ b/src/intel/vulkan/anv_intel.c
@@ -55,7 +55,7 @@ VkResult anv_CreateDmaBufImageINTEL(
goto fail;
}
- uint64_t size = pCreateInfo->strideInBytes * pCreateInfo->extent.height;
+ uint64_t size = (uint64_t)pCreateInfo->strideInBytes * pCreateInfo->extent.height;
anv_bo_init(&mem->bo, gem_handle, size);