Skip to content

Commit

Permalink
fix panic found by fuzzer (#8)
Browse files Browse the repository at this point in the history
fuzzer found panic for trivial empty table `|||` - let's fix it
  • Loading branch information
sivukhin authored Sep 5, 2024
2 parents c976456 + d392f90 commit 9170633
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion djot_parser/djot_ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ func buildDjotAst(
for s := i + 1; s < i+openToken.JumpToPair; s++ {
if list[s].Type == djot_tokenizer.PipeTableSeparator {
columns++
content := document[list[s].Start+1 : list[s+list[s].JumpToPair].End-1]
content := document[list[s].Start+1 : list[s+list[s].JumpToPair].Start]
dashCount := bytes.Count(content, []byte("-"))
if dashCount == 0 {
continue
Expand Down
2 changes: 2 additions & 0 deletions djot_parser/testdata/fuzz/FuzzDjotE2E/e6a6fccfa2e3278f
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
go test fuzz v1
string("|||")

0 comments on commit 9170633

Please sign in to comment.