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

Crash in infoschema.FormatTiDBVersion #39059

Closed
secsys-go opened this issue Nov 10, 2022 · 1 comment · Fixed by #39172
Closed

Crash in infoschema.FormatTiDBVersion #39059

secsys-go opened this issue Nov 10, 2022 · 1 comment · Fixed by #39172
Assignees
Labels
severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@secsys-go
Copy link

Bug Report

We used the Fuzz engine to modify some Test(TestFormatVersion) data, and then the following crash appeared. We hope to get the help of the developer to confirm whether it is a real bug.

1. Minimal reproduce step (Required)

Simplified Test Code

infoschema.FormatTiDBVersion("5.7.2Delta;5-TiDB-", true)

2. What did you expect to see? (Required)

Test Passed

3. What did you see instead (Required)

Crash Log

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

goroutine 125 [running]:
testing.tRunner.func1.2({0x373e4a0, 0xc0005bae70})
	/home/gogen/.local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
	/home/gogen/.local/go/src/testing/testing.go:1212 +0x218
panic({0x373e4a0, 0xc0005bae70})
	/home/gogen/.local/go/src/runtime/panic.go:1038 +0x215
github.com/pingcap/tidb/infoschema.FormatTiDBVersion({0x3939818, 0x12}, 0x0)
	/home/gogen/workspace/gowork/src/topproj/tidb/infoschema/tables.go:1615 +0x179
github.com/pingcap/tidb/infoschema_test.FuzzTestFormatVersion({0xc000436800, 0x22, 0x200})
	/home/gogen/workspace/gowork/src/topproj/tidb/infoschema/tables_test.go_TestFormatVersion_test.go:27 +0x9b

4. What is your TiDB version? (Required)

9c4f94d

@secsys-go secsys-go added the type/bug The issue is confirmed as a bug. label Nov 10, 2022
@YangKeao
Copy link
Member

Though it seems that the FormatTiDBVersion actually expected some specific format of versions, I prefer to keep this issue, as this problem is really annoying in some cases (sometimes I manually modified this function to return a constant value, to make it run on some platforms...).

Maybe we could have a more convincing FormatTiDBVersion. At least return unknown or nightly when the version is not expected 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants