gguf : reject empty metadata keys (llama/24917)
This commit is contained in:
parent
f00dc30f2c
commit
dbe941f2b9
|
|
@ -557,6 +557,10 @@ static struct gguf_context * gguf_init_from_reader(const struct gguf_reader & gr
|
||||||
GGML_LOG_ERROR("%s: encountered bad_alloc error while reading key %" PRIi64 "\n", __func__, i);
|
GGML_LOG_ERROR("%s: encountered bad_alloc error while reading key %" PRIi64 "\n", __func__, i);
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
if (ok && key.empty()) {
|
||||||
|
GGML_LOG_ERROR("%s: key %" PRIi64 " is empty\n", __func__, i);
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
for (size_t j = 0; ok && j < ctx->kv.size(); ++j) {
|
for (size_t j = 0; ok && j < ctx->kv.size(); ++j) {
|
||||||
if (key == ctx->kv[j].key) {
|
if (key == ctx->kv[j].key) {
|
||||||
GGML_LOG_ERROR("%s: duplicate key '%s' for tensors %zu and %" PRIi64 " \n", __func__, key.c_str(), j, i);
|
GGML_LOG_ERROR("%s: duplicate key '%s' for tensors %zu and %" PRIi64 " \n", __func__, key.c_str(), j, i);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue