Commit 71a6a114b for llama.cpp
commit 71a6a114bca2f0901cb88da36eca8d4720e22ec5
Author: JamieBordoni <jamie.bordoni@protonmail.com>
Date: Wed Nov 11 11:13:28 2026 +0000
quantize: fix imatrix GGUF filepath metadata leak (#32000)
diff --git a/tools/quantize/quantize.cpp b/tools/quantize/quantize.cpp
index 38950036c..0debcfdda 100644
--- a/tools/quantize/quantize.cpp
+++ b/tools/quantize/quantize.cpp
@@ -510,7 +510,8 @@ int llama_quantize(int argc, char ** argv) {
llama_model_kv_override kvo;
std::strcpy(kvo.key, LLM_KV_QUANTIZE_IMATRIX_FILE);
kvo.tag = LLAMA_KV_OVERRIDE_TYPE_STR;
- strncpy(kvo.val_str, imatrix_file.c_str(), 127);
+ const std::string fname_imatrix = std::filesystem::path(imatrix_file).filename().string();
+ strncpy(kvo.val_str, fname_imatrix.c_str(), 127);
kvo.val_str[127] = '\0';
kv_overrides.emplace_back(std::move(kvo));
}
@@ -519,7 +520,8 @@ int llama_quantize(int argc, char ** argv) {
// TODO: list multiple datasets when there are more than one
std::strcpy(kvo.key, LLM_KV_QUANTIZE_IMATRIX_DATASET);
kvo.tag = LLAMA_KV_OVERRIDE_TYPE_STR;
- strncpy(kvo.val_str, imatrix_datasets[0].c_str(), 127);
+ const std::string fname_dataset = std::filesystem::path(imatrix_datasets[0]).filename().string();
+ strncpy(kvo.val_str, fname_dataset.c_str(), 127);
kvo.val_str[127] = '\0';
kv_overrides.emplace_back(std::move(kvo));
}