speculative : fix out-of-bounds access (#10289)

This commit is contained in:
Georgi Gerganov 2024-11-14 11:44:15 +02:00 committed by GitHub
parent af148c9386
commit 2a82891a85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -267,11 +267,12 @@ int main(int argc, char ** argv) {
for (size_t i = 0; i < dist_tgt.size; i++) {
if (dist_tgt.data[i].id == drafts[s].tokens[i_dft]) {
p_tgt = dist_tgt.data[i].p;
break;
}
}
for (size_t i = 0; i < dist_dft.size; i++) {
if (dist_dft.data[i].id == drafts[s].tokens[i_dft]) {
p_dft = dist_dft.data[i].p;
}
if (p_tgt && p_dft) {
break;
}
}