Skip to content

Commit a3fb9c7

Browse files
ggerganovarthw
authored andcommitted
speculative : fix out-of-bounds access (ggml-org#10289)
1 parent a9cf8de commit a3fb9c7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/speculative/speculative.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,12 @@ int main(int argc, char ** argv) {
267267
for (size_t i = 0; i < dist_tgt.size; i++) {
268268
if (dist_tgt.data[i].id == drafts[s].tokens[i_dft]) {
269269
p_tgt = dist_tgt.data[i].p;
270+
break;
270271
}
272+
}
273+
for (size_t i = 0; i < dist_dft.size; i++) {
271274
if (dist_dft.data[i].id == drafts[s].tokens[i_dft]) {
272275
p_dft = dist_dft.data[i].p;
273-
}
274-
if (p_tgt && p_dft) {
275276
break;
276277
}
277278
}

0 commit comments

Comments
 (0)