Skip to content

Commit 1a2ed55

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

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
@@ -262,11 +262,12 @@ int main(int argc, char ** argv) {
262262
for (size_t i = 0; i < dist_tgt.size; i++) {
263263
if (dist_tgt.data[i].id == drafts[s].tokens[i_dft]) {
264264
p_tgt = dist_tgt.data[i].p;
265+
break;
265266
}
267+
}
268+
for (size_t i = 0; i < dist_dft.size; i++) {
266269
if (dist_dft.data[i].id == drafts[s].tokens[i_dft]) {
267270
p_dft = dist_dft.data[i].p;
268-
}
269-
if (p_tgt && p_dft) {
270271
break;
271272
}
272273
}

0 commit comments

Comments
 (0)