Skip to content

Commit

Permalink
llamacpp: fix tokenizer harness
Browse files Browse the repository at this point in the history
Signed-off-by: David Korczynski <[email protected]>
  • Loading branch information
DavidKorczynski committed Oct 20, 2024
1 parent 4e5e6bf commit c453530
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion projects/llamacpp/fuzzers/fuzz_tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
common_detokenize(ctx, tokens);

if (setjmp(fuzzing_jmp_buf) == 0) {
llama_decode(ctx, llama_batch_get_one(tokens.data(), tokens.size()));
auto batch = llama_batch_get_one(tokens.data(), tokens.size());
if (batch.n_tokens > 0) {
llama_decode(ctx, batch);
}
}
} catch (...) {
}
Expand Down

0 comments on commit c453530

Please sign in to comment.