fix(contrib/drivers/oracle): fix GBK decode and quoted identifiers - #4836
Open
yuyinw wants to merge 2 commits into
Open
fix(contrib/drivers/oracle): fix GBK decode and quoted identifiers#4836yuyinw wants to merge 2 commits into
yuyinw wants to merge 2 commits into
Conversation
added 2 commits
August 6, 2026 10:43
Upgrade github.com/sijms/go-ora/v2 from v2.7.10 to v2.7.18, the smallest upstream release that fixes StringConverter.Decode for charset case 0x354. In v2.7.10, the case 0x354 branch checked index+1 > len(input) before calling binary.BigEndian.Uint16(input[index:]). When input[index:] contained only one trailing byte and input[index] was greater than 0x80, Uint16 required two bytes and panicked with index out of range. v2.7.18 changes the guard to index+1 >= len(input), returning safely for truncated input. Add a focused dependency regression test that decodes a trailing GBK lead byte without requiring an Oracle database connection, and record the feedback in OpenSpec.
Oracle treats double-quoted identifiers as case-sensitive. The previous DoFilter removed every double quote before parsing SQL, so raw SQL targeting mixed-case table or column names was sent as unquoted identifiers and Oracle uppercased them. Keep explicit quotes in raw SQL and make generated SQL use Oracle's unquoted identifier path by returning empty quote chars. This preserves ordinary lowercase model/table operations while allowing users to opt in to case-sensitive identifiers explicitly. Add focused filter tests for quoted identifiers, placeholder conversion, LIMIT rewriting, and default quote chars.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Oracle driver had two independent issues:
github.com/sijms/go-ora/v2 v2.7.10can panic while decoding truncated GBK input. In charset case0x354, the old guard allowed a trailing one-byte slice to reachbinary.BigEndian.Uint16(input[index:]), which requires two bytes.Driver.DoFilterremoved every double quote from SQL before parsing. Oracle treats double-quoted identifiers as case-sensitive, so raw SQL targeting mixed-case table or column names was sent as unquoted identifiers and Oracle uppercased them.What changed
github.com/sijms/go-ora/v2tov2.7.18, the smallest upstream release that includes the GBK decode bounds-check fix.Testing
go test -run 'TestDriver(DoFilterPreservesQuotedIdentifiers|GetCharsDoesNotAddImplicitQuotes)$|^TestStringConverterDecodeGBKTrailingLeadByte$' ./...go test -run '^$' ./...