diff --git a/src/ggml.c b/src/ggml.c index 29e18a24c..388bb3df6 100644 --- a/src/ggml.c +++ b/src/ggml.c @@ -18639,6 +18639,11 @@ struct gguf_context * gguf_init_from_file(const char * fname, struct gguf_init_p info->ne[j] = 1; } + if (strlen(info->name.data) > GGML_MAX_NAME - 1) { + fprintf(stderr, "%s: tensor name '%s' is too long (maximum length: %d characters)\n", __func__, info->name.data, GGML_MAX_NAME - 1); + ok = false; + } + ok = ok && gguf_fread_str(file, &info->name, &offset); ok = ok && gguf_fread_el (file, &info->n_dims, sizeof(info->n_dims), &offset); for (uint32_t j = 0; j < info->n_dims; ++j) {