From d392f9058521c77c0d4adb5ee03dc7dc0cffc4fd Mon Sep 17 00:00:00 2001 From: Nikita Sivukhin Date: Thu, 5 Sep 2024 21:36:24 +0400 Subject: [PATCH] fix panic found by fuzzer --- djot_parser/djot_ast.go | 2 +- djot_parser/testdata/fuzz/FuzzDjotE2E/e6a6fccfa2e3278f | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 djot_parser/testdata/fuzz/FuzzDjotE2E/e6a6fccfa2e3278f diff --git a/djot_parser/djot_ast.go b/djot_parser/djot_ast.go index ee61ff1..5eba8e4 100644 --- a/djot_parser/djot_ast.go +++ b/djot_parser/djot_ast.go @@ -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 diff --git a/djot_parser/testdata/fuzz/FuzzDjotE2E/e6a6fccfa2e3278f b/djot_parser/testdata/fuzz/FuzzDjotE2E/e6a6fccfa2e3278f new file mode 100644 index 0000000..e3c45e8 --- /dev/null +++ b/djot_parser/testdata/fuzz/FuzzDjotE2E/e6a6fccfa2e3278f @@ -0,0 +1,2 @@ +go test fuzz v1 +string("|||")