Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

parser: can't handle multiline comments that do not close #100

Open
tsatke opened this issue Apr 19, 2021 · 0 comments
Open

parser: can't handle multiline comments that do not close #100

tsatke opened this issue Apr 19, 2021 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tsatke
Copy link
Contributor

tsatke commented Apr 19, 2021

Describe the bug
Fuzzing.

To Reproduce
Input:

/*..*...........

Hex:

2F 2A 03 09 2A 00 00 00 00 00 00 00 00 00 00 00

Panic:

panic: runtime error: index out of range [5] with length 5

goroutine 1 [running]:
runtime/debug.Stack(0xc0001fe2b8, 0xc00001a1c0, 0x33)
	/usr/local/go/src/runtime/debug/stack.go:24 +0xfd
git.fuzzbuzz.io/fuzz.(*F).Close(0xc00020e000)
	git.fuzzbuzz.io/fuzz/f_obj.go:609 +0x7b2
panic(0x779180, 0xc0001fe2b8)
	runtime/panic.go:965 +0x1b9
github.com/xqueries/xdb/internal/parser/scanner.(*ruleBasedScanner).ConsumeRune(0xc0002067e0)
	/src/internal/parser/scanner/rule_based_scanner.go:258 +0xe7
github.com/xqueries/xdb/internal/parser/scanner.(*ruleBasedScanner).drainComment.func2(0xc0002067e0, 0x0)
	/src/internal/parser/scanner/rule_based_scanner.go:178 +0x34a
github.com/xqueries/xdb/internal/parser/scanner.(*ruleBasedScanner).drainComment(0xc0002067e0, 0x756980)
	/src/internal/parser/scanner/rule_based_scanner.go:198 +0x1ee
github.com/xqueries/xdb/internal/parser/scanner.(*ruleBasedScanner).drainWhitespacesAndComments(0xc0002067e0)
	/src/internal/parser/scanner/rule_based_scanner.go:119 +0x87
github.com/xqueries/xdb/internal/parser/scanner.(*ruleBasedScanner).computeNext(0xc0002067e0, 0xa, 0xa)
	/src/internal/parser/scanner/rule_based_scanner.go:92 +0x47
github.com/xqueries/xdb/internal/parser/scanner.(*ruleBasedScanner).Peek(0xc0002067e0, 0x0, 0x0)
	/src/internal/parser/scanner/rule_based_scanner.go:74 +0xb2
github.com/xqueries/xdb/internal/parser.(*simpleParser).Next(0xc00004fec0, 0x5, 0x7ed8e0, 0xc00004fec0, 0x0, 0x0)
	/src/internal/parser/simple_parser.go:28 +0x4f
github.com/xqueries/xdb.Fuzz(0xc0001f8a76, 0x5, 0x6, 0x0)
	/src/xdb_fuzz.go:35 +0x115
github.com/xqueries/xdb.FuzzGoFuzzFuzz(0xc00020e000)
	/src/fuzzbuzz_autogen.go:7 +0x8c
github.com/xqueries/xdb/fuzzing/fuzzbuzzauto.FuzzFunction0(...)
	/src/fuzzing/fuzzbuzzauto/fuzz.go:8
github.com/xqueries/xdb/fuzzing/fuzzbuzzauto.FuzzFunction0_FuzzWrapper(0xb5196858a4ba43c3, 0x73cac0, 0xc0001f5140, 0x0)
	github.com/xqueries/xdb/fuzzing/fuzzbuzzauto/fuzzwrappers.go:12 +0x91
git.fuzzbuzz.io/fuzz/endpoint.(*StandardFuzzEndpoint).StartMain(0xc000119e28)
	git.fuzzbuzz.io/fuzz/endpoint/endpoint.go:124 +0x422
base-dep.Main(0x9eb938, 0x0, 0x0, 0xc00001cb30, 0x4, 0x4, 0xc000010050, 0x1, 0x1)
	base-dep/main.go:43 +0x329
main.main()
	github.com/xqueries/xdb/fuzzing/fuzzbuzzauto/go.fuzz.main/main.go:18 +0xc5
@tsatke tsatke added the bug Something isn't working label Apr 19, 2021
@tsatke tsatke added this to the v0.0.1 milestone Apr 19, 2021
@tsatke tsatke changed the title parser can't handle multiline comments that do not close parser: can't handle multiline comments that do not close Apr 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants