From: Junyan He <[email protected]>

Signed-off-by: Junyan He <[email protected]>
---
 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


_______________________________________________
Beignet mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to