isDDL and removeStatementHint panic with invalid query
Closed this issue · 0 comments
egonelbre commented
It's possible to make things panic with an invalid query:
Failing examples are in #250
--- FAIL: FuzzIsDdl (0.21s)
--- FAIL: FuzzIsDdl (0.00s)
testing.go:1590: panic: runtime error: slice bounds out of range [:6] with length 0
goroutine 121 [running]:
runtime/debug.Stack()
C:/Program Files/Go/src/runtime/debug/stack.go:24 +0x9b
testing.tRunner.func1()
C:/Program Files/Go/src/testing/testing.go:1590 +0x1c8
panic({0x1ff99e0?, 0xc0001358c0?})
C:/Program Files/Go/src/runtime/panic.go:770 +0x132
github.com/googleapis/go-sql-spanner.isDDL({0x0?, 0x0?})
s:/deps/go-sql-spanner/statement_parser.go:313 +0x1f8
github.com/googleapis/go-sql-spanner.FuzzIsDdl.func1(0x0?, {0x0?, 0x0?})
s:/deps/go-sql-spanner/statement_parser_test.go:870 +0x3b
And in FuzzRemoveStatementHint
, with:
--- FAIL: FuzzRemoveStatementHint (6.19s)
--- FAIL: FuzzRemoveStatementHint (0.00s)
testing.go:1590: panic: runtime error: slice bounds out of range [:12] with length 10
goroutine 3450 [running]:
runtime/debug.Stack()
C:/Program Files/Go/src/runtime/debug/stack.go:24 +0x9b
testing.tRunner.func1()
C:/Program Files/Go/src/testing/testing.go:1590 +0x1c8
panic({0x1f599e0?, 0xc0003eaee8?})
C:/Program Files/Go/src/runtime/panic.go:770 +0x132
github.com/googleapis/go-sql-spanner.removeStatementHint({0xc00714c116, 0xa})
s:/deps/go-sql-spanner/statement_parser.go:181 +0x35c
github.com/googleapis/go-sql-spanner.FuzzRemoveStatementHint.func1(0x0?, {0xc00714c116?, 0x0?})
s:/deps/go-sql-spanner/statement_parser_test.go:491 +0x3b