From 9f547279246f629655d6f4081976ffcf3930d932 Mon Sep 17 00:00:00 2001 From: Qichao Gu Date: Wed, 16 Oct 2024 01:01:36 +0800 Subject: [PATCH] Fix integer overflow in 1D buffer image tests (#2092) --- test_conformance/images/clCopyImage/test_copy_1D_buffer.cpp | 2 +- test_conformance/images/clFillImage/test_fill_1D_buffer.cpp | 2 +- test_conformance/images/clGetInfo/test_1D_buffer.cpp | 2 +- .../images/clReadWriteImage/test_read_1D_buffer.cpp | 2 +- test_conformance/images/kernel_image_methods/test_1D_buffer.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test_conformance/images/clCopyImage/test_copy_1D_buffer.cpp b/test_conformance/images/clCopyImage/test_copy_1D_buffer.cpp index f8f14bd4..f74e60a9 100644 --- a/test_conformance/images/clCopyImage/test_copy_1D_buffer.cpp +++ b/test_conformance/images/clCopyImage/test_copy_1D_buffer.cpp @@ -182,7 +182,7 @@ int test_copy_image_set_1D_buffer(cl_device_id device, cl_context context, do { imageInfo.width = - (size_t)random_log_in_range(16, (int)maxWidth / 32, seed); + (size_t)random_log_in_range(16, (int)(maxWidth / 32), seed); imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding; diff --git a/test_conformance/images/clFillImage/test_fill_1D_buffer.cpp b/test_conformance/images/clFillImage/test_fill_1D_buffer.cpp index e3079c46..dad389ae 100644 --- a/test_conformance/images/clFillImage/test_fill_1D_buffer.cpp +++ b/test_conformance/images/clFillImage/test_fill_1D_buffer.cpp @@ -171,7 +171,7 @@ int test_fill_image_set_1D_buffer(cl_device_id device, cl_context context, do { imageInfo.width = - (size_t)random_log_in_range(16, (int)maxWidth / 32, seed); + (size_t)random_log_in_range(16, (int)(maxWidth / 32), seed); imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding; diff --git a/test_conformance/images/clGetInfo/test_1D_buffer.cpp b/test_conformance/images/clGetInfo/test_1D_buffer.cpp index 7b0c2d1c..45842b1d 100644 --- a/test_conformance/images/clGetInfo/test_1D_buffer.cpp +++ b/test_conformance/images/clGetInfo/test_1D_buffer.cpp @@ -99,7 +99,7 @@ int test_get_image_info_1D_buffer(cl_device_id device, cl_context context, do { imageInfo.width = - (size_t)random_log_in_range(16, (int)maxWidth / 32, seed); + (size_t)random_log_in_range(16, (int)(maxWidth / 32), seed); imageInfo.rowPitch = imageInfo.width * pixelSize; size_t extraWidth = (int)random_log_in_range(0, 64, seed); diff --git a/test_conformance/images/clReadWriteImage/test_read_1D_buffer.cpp b/test_conformance/images/clReadWriteImage/test_read_1D_buffer.cpp index 01dd80dc..4b1aa14f 100644 --- a/test_conformance/images/clReadWriteImage/test_read_1D_buffer.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_1D_buffer.cpp @@ -230,7 +230,7 @@ int test_read_image_set_1D_buffer(cl_device_id device, cl_context context, do { imageInfo.width = - (size_t)random_log_in_range(16, (int)maxWidth / 32, seed); + (size_t)random_log_in_range(16, (int)(maxWidth / 32), seed); imageInfo.rowPitch = imageInfo.width * pixelSize; if (gEnablePitch) diff --git a/test_conformance/images/kernel_image_methods/test_1D_buffer.cpp b/test_conformance/images/kernel_image_methods/test_1D_buffer.cpp index 5430f873..2e10d975 100644 --- a/test_conformance/images/kernel_image_methods/test_1D_buffer.cpp +++ b/test_conformance/images/kernel_image_methods/test_1D_buffer.cpp @@ -250,7 +250,7 @@ int test_get_image_info_1D_buffer(cl_device_id device, cl_context context, do { imageInfo.width = - (size_t)random_log_in_range(16, (int)maxWidth / 32, seed); + (size_t)random_log_in_range(16, (int)(maxWidth / 32), seed); imageInfo.rowPitch = imageInfo.width * pixelSize; size_t extraWidth = (int)random_log_in_range(0, 64, seed);