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

Import scanner performs bound check after buffer access #8495

Closed
max-hoffman opened this issue Oct 25, 2024 · 0 comments · Fixed by #8494
Closed

Import scanner performs bound check after buffer access #8495

max-hoffman opened this issue Oct 25, 2024 · 0 comments · Fixed by #8494
Labels
bug Something isn't working import

Comments

@max-hoffman
Copy link
Contributor

max-hoffman commented Oct 25, 2024

The import scanner has a for loop that panics because we check to extend the buffer only after accessing. The check needs to precede buffer access.

panic: runtime error: index out of range [16384] with length 16384 goroutine 1 [running]: github.com/dolthub/dolt/go/cmd/dolt/commands.(*streamScanner).Scan(0xc004b99158) github.com/dolthub/dolt/go/cmd/dolt/commands/sql_statement_scanner.go:99 +0x299 

This is a simple query that repros: strings.Repeat(" ", 4096) + "insert into foo values (1,2,3)". The whitespace truncator has a bad bounds check on the 4096th byte.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working import
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant