Mesa (master): anv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL

Emil Velikov evelikov at kemper.freedesktop.org
Tue Nov 22 15:49:54 UTC 2016


Module: Mesa
Branch: master
Commit: e074a08a6ded3260f13111d0e23961dea2da2442
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e074a08a6ded3260f13111d0e23961dea2da2442

Author: Gwan-gyeong Mun <elongbug at gmail.com>
Date:   Sun Nov 20 20:44:22 2016 +0900

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 at lists.freedesktop.org>
Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
[Emil Velikov: cast only of the arguments]
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

---

 src/intel/vulkan/anv_intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
 




More information about the mesa-commit mailing list