Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic in prepareExpression #301

Closed
0x34d opened this issue Oct 6, 2023 · 0 comments
Closed

Panic in prepareExpression #301

0x34d opened this issue Oct 6, 2023 · 0 comments

Comments

@0x34d
Copy link
Contributor

0x34d commented Oct 6, 2023

Bug Note:

file: fbclock/daemon/math_test.go, ptp/c4u/clock/math_test.go

func TestPrepareExpression_bug(t *testing.T) {

	prepareExpression(string("\\"))
}

run : go test -run TestPrepareExpression_bug $(pwd)/fbclock/daemon

backtrace

--- FAIL: TestPrepareExpression_bug (0.00s)
panic: runtime error: index out of range [1] with length 1 [recovered]
	panic: runtime error: index out of range [1] with length 1

goroutine 79 [running]:
testing.tRunner.func1.2({0x9a8900, 0xc000296660})
	/usr/lib/golang/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
	/usr/lib/golang/src/testing/testing.go:1529 +0x39f
panic({0x9a8900, 0xc000296660})
	/usr/lib/golang/src/runtime/panic.go:884 +0x213
github.com/Knetic/govaluate.(*lexerStream).readCharacter(...)
	/home/0x34d/tools/go/pkg/mod/github.com/!knetic/govaluate@v3.0.0+incompatible/lexerStream.go:28
github.com/Knetic/govaluate.readUntilFalse(0xc000085d60, 0x0, 0x1, 0x1, 0xa044b0)
	/home/0x34d/tools/go/pkg/mod/github.com/!knetic/govaluate@v3.0.0+incompatible/parsing.go:272 +0x473
github.com/Knetic/govaluate.readTokenUntilFalse(0xc00000005c?, 0xc0000287a8?)
	/home/0x34d/tools/go/pkg/mod/github.com/!knetic/govaluate@v3.0.0+incompatible/parsing.go:249 +0x4c
github.com/Knetic/govaluate.readToken(0xc000085d60, {0x0, 0x1, 0x0, {0xc74ce0, 0x9, 0x9}}, 0x26?)
	/home/0x34d/tools/go/pkg/mod/github.com/!knetic/govaluate@v3.0.0+incompatible/parsing.go:193 +0x9f7
github.com/Knetic/govaluate.parseTokens({0xa62a90, 0x1}, 0x544873?)
	/home/0x34d/tools/go/pkg/mod/github.com/!knetic/govaluate@v3.0.0+incompatible/parsing.go:27 +0x31f
github.com/Knetic/govaluate.NewEvaluableExpressionWithFunctions({0xa62a90, 0x1}, 0x544840?)
	/home/0x34d/tools/go/pkg/mod/github.com/!knetic/govaluate@v3.0.0+incompatible/EvaluableExpression.go:99 +0x9f
github.com/facebook/time/fbclock/daemon.prepareExpression({0xa62a90?, 0x48ded7?})
	/home/0x34d/project/time/fbclock/daemon/math.go:198 +0x5a
github.com/facebook/time/fbclock/daemon.TestPrepareExpression_bug(0xc0002b0340?)
	/home/0x34d/project/time/fbclock/daemon/math_test.go:141 +0x47
testing.tRunner(0xc0002b11e0, 0xa045f8)
	/usr/lib/golang/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
	/usr/lib/golang/src/testing/testing.go:1629 +0x3ea
exit status 2
FAIL	github.com/facebook/time/fbclock/daemon	0.010s
facebook-github-bot pushed a commit that referenced this issue Oct 9, 2023
Summary:
Add more fuzz tests.

Pull Request resolved: #300

Test Plan:
```bash
go test -fuzz=FuzzPrepareExpression         $(pwd)/fbclock/daemon
go test -fuzz=FuzzCompute                   $(pwd)/leaphash
go test -fuzz=FuzzNormalizeData             $(pwd)/ntp/control
```

Bug: #301

Reviewed By: vvfedorenko

Differential Revision: D50078674

Pulled By: abulimov

fbshipit-source-id: 8978e0132db061f76bab12c0f4d0913dee307f8b
@0x34d 0x34d closed this as completed Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant