修正Slice内存越界问题 (#204)

fix (slice): add guard for area out of range

Co-authored-by: Haojie Wang <haojie0429@gmail.com>
This commit is contained in:
PanZezhong1725 2024-01-05 09:19:50 +08:00 committed by GitHub
parent b15c4979fa
commit 46e61a5bd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@ __global__ void _pad_slice_kernel(T *part, T *whole, TransMetaData metaData,
whole[tid] = 0;
else
whole[tid] = part[offset];
else
else if (offset >= 0)
part[offset] = whole[tid];
tid += stride;
}