fix: reject a repeated entry with an inconsistent value count in load_imatrix (#1749) (#1750)

This commit is contained in:
m00dy
2026-07-06 07:11:27 -07:00
committed by GitHub
parent 9e1055d2e3
commit 4fcc6fef10

View File

@@ -287,6 +287,10 @@ bool IMatrixCollector::load_imatrix(const char* fname) {
if (e.values.empty()) {
e.values.resize(nval, 0);
e.counts.resize(nval, 0);
} else if (e.values.size() != (size_t)nval) {
LOG_ERROR("inconsistent size for a repeated entry (%d vs %d)\n", (int)e.values.size(), nval);
stats_ = {};
return false;
}
std::vector<float> tmp(nval);