[Beignet] [PATCH 3/3] Fix a bug in mem rect copy
junyan.he at inbox.com
junyan.he at inbox.com
Thu Aug 4 10:03:13 UTC 2016
From: Junyan He <junyan.he at intel.com>
Signed-off-by: Junyan He <junyan.he at intel.com>
---
src/cl_api_mem.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/cl_api_mem.c b/src/cl_api_mem.c
index 9257a72..867b489 100644
--- a/src/cl_api_mem.c
+++ b/src/cl_api_mem.c
@@ -973,8 +973,14 @@ clEnqueueCopyBufferRect(cl_command_queue command_queue,
total_size = (src_origin[2] + region[2] - 1) * src_slice_pitch +
(src_origin[1] + region[1] - 1) * src_row_pitch + src_origin[0] + region[0];
+ if (total_size > src_buffer->size) {
+ err = CL_INVALID_VALUE;
+ break;
+ }
- if (total_size > src_buffer->size || total_size > dst_buffer->size) {
+ total_size = (dst_origin[2] + region[2] - 1) * dst_slice_pitch +
+ (dst_origin[1] + region[1] - 1) * dst_row_pitch + dst_origin[0] + region[0];
+ if (total_size > dst_buffer->size) {
err = CL_INVALID_VALUE;
break;
}
--
2.7.4
____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.
Check it out at http://mysecurelogon.com/password-manager
More information about the Beignet
mailing list