Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gguflib.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,10 @@ int gguf_get_tensor(gguf_ctx *ctx, gguf_tensor *tensor) {
uint32_t *num_dim = (uint32_t*) (ctx->data+ctx->off);
ctx->off += 4; // Skip number of dimensions.
tensor->ndim = *num_dim;
assert(tensor->ndim <= GGUF_TENSOR_MAX_DIM);
if (tensor->ndim > GGUF_TENSOR_MAX_DIM) {
tensor->name = NULL;
return 0;
}

/* Read the dimentions: all the unused dimensions are set to 1. */
tensor->num_weights = 1;
Expand Down