Skip to content

Commit 9ef79d3

Browse files
author
Iwan Kawrakow
committed
Log out of bounds access details
1 parent 15911fa commit 9ef79d3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ggml/src/ggml-backend.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ size_t ggml_backend_get_max_size(ggml_backend_t backend) {
200200

201201
void ggml_backend_tensor_set_async(ggml_backend_t backend, struct ggml_tensor * tensor, const void * data, size_t offset, size_t size) {
202202
GGML_ASSERT(tensor->data != NULL && "tensor not allocated");
203+
if (offset + size > ggml_nbytes(tensor)) fprintf(stderr, "%s(%s): offset = %zu, size = %zu, nbytes = %zu\n", __func__, tensor->name, offset, size, ggml_nbytes(tensor));
203204
GGML_ASSERT(offset + size <= ggml_nbytes(tensor) && "tensor write out of bounds");
204205

205206
if (backend->iface.set_tensor_async == NULL) {

0 commit comments

Comments
 (0)