-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
index out of range [4] with length 1 in executor.(*LimitExec).Next
->chunk.(*Chunk).TruncateTo
#55885
Comments
simplest reproduce sql
The root cause of this issue is
Note that tidb/pkg/expression/evaluator.go Lines 26 to 50 in 1dc3851
So the chunk output by Projection_23 will be something likecol1, col1, col3, col4, ... 3. In LimitExec , it may contain inlined projection by setting the output column in columnIdxsUsedByChild Lines 1363 to 1364 in 1dc3851
5. In LimitExec.Next , it use SwapColumn to do the inline projection, which will got wrong result if the inline projection index actually pointing to the same column in chunkLines 1426 to 1430 in 1dc3851
For example, if columnIdxsUsedByChild is [0, 1], and the input chunk is col1, col1, col3, col4, ... After swap column 0, the result chunk is col1, nil and the input chunk is nil, nil, col3, col4, ... After swap column 1, the result chunk is col1, nil and the input chunk is nil, nil, col3, col4, ... So the final result chunk is col1, nil , and the expected result chunk is col1, col1
|
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
SQL to init database
SQL that causes error
2. What did you expect to see? (Required)
Expect no crashes
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
We are the BASS team from the School of Cyber Science and Technology at Beihang University. Our main focus is on system software security, operating systems, and program analysis research, as well as the development of automated program testing frameworks for detecting software defects. Using our self-developed database vulnerability testing tool, we have identified the above-mentioned vulnerabilities in TiDB that may lead to database crashes.
The text was updated successfully, but these errors were encountered: