[Mesa-dev] [PATCH] anv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL
Mun Gwan-gyeong
elongbug at gmail.com
Sun Nov 20 11:44:22 UTC 2016
pCreateInfo->strideInBytes * pCreateInfo->extent.height with type
"unsigned int" is evaluated using 32-bit arithmetic.
This fixes unintentional integer overflow by casting to uint64_t before
multifying.
CID 1394321
Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.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..8b251f8 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 * (uint64_t)pCreateInfo->extent.height;
anv_bo_init(&mem->bo, gem_handle, size);
--
2.10.2
More information about the mesa-dev
mailing list