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

fix: prevent potential panic in RemoveStatementHint #253

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

olavloite
Copy link
Collaborator

The RemoveStatementHint function converts the SQL string to upper case for simple checking for specific prefixes. This check did however not take into account that the length of a string in upper case can be different from the length in lower/mixed case. SQL strings with any of those characters in the relevant parts (hint or first keyword) are not valid, so in those cases the original SQL string is returned.

Fixes #251

The RemoveStatementHint function converts the SQL string to
upper case for simple checking for specific prefixes. This
check did however not take into account that the length of
a string in upper case can be different from the length in
lower/mixed case. SQL strings with any of those characters
in the relevant parts (hint or first keyword) are not valid,
so in those cases the original SQL string is returned.

Fixes #251
@olavloite olavloite requested a review from a team as a code owner June 12, 2024 11:36
@rahul2393 rahul2393 merged commit 7d7155b into main Jun 17, 2024
17 checks passed
gcf-merge-on-green bot pushed a commit that referenced this pull request Jul 1, 2024
🤖 I have created a release *beep* *boop*
---


## [1.5.0](https://togithub.com/googleapis/go-sql-spanner/compare/v1.4.0...v1.5.0) (2024-07-01)


### Features

* Add -race to testing ([#263](https://togithub.com/googleapis/go-sql-spanner/issues/263)) ([3af784b](https://togithub.com/googleapis/go-sql-spanner/commit/3af784b0a786c7079f14a63cbef5da4ad7ad3138))
* Add fuzzing for statement parser ([#250](https://togithub.com/googleapis/go-sql-spanner/issues/250)) ([2e74813](https://togithub.com/googleapis/go-sql-spanner/commit/2e7481307b02ec2deb98599e22362ee727d0fc1b))
* Add int support ([#260](https://togithub.com/googleapis/go-sql-spanner/issues/260)) ([ec15462](https://togithub.com/googleapis/go-sql-spanner/commit/ec1546238603f409a0aba6627459365c46a92c2b)), refs [#257](https://togithub.com/googleapis/go-sql-spanner/issues/257)
* **examples/data-types:** Add float32 ([#261](https://togithub.com/googleapis/go-sql-spanner/issues/261)) ([4d6d1ef](https://togithub.com/googleapis/go-sql-spanner/commit/4d6d1ef0856cd6b964675cb64a3f4c7335e010dc))


### Bug Fixes

* []*int and []*uint ([#267](https://togithub.com/googleapis/go-sql-spanner/issues/267)) ([d24b55a](https://togithub.com/googleapis/go-sql-spanner/commit/d24b55ade2c4c4f5ce01d1f3fcbec41e6ad0d50c))
* **examples:** Make compilable and add a test runner for the samples ([#256](https://togithub.com/googleapis/go-sql-spanner/issues/256)) ([b9c0b4d](https://togithub.com/googleapis/go-sql-spanner/commit/b9c0b4d5e5fbfdb3bb358d9a54f66029855a0b2f))
* Prevent potential panic in RemoveStatementHint ([#253](https://togithub.com/googleapis/go-sql-spanner/issues/253)) ([7d7155b](https://togithub.com/googleapis/go-sql-spanner/commit/7d7155b2bbc430ed88420d8bf92abbb59638adb4)), refs [#251](https://togithub.com/googleapis/go-sql-spanner/issues/251)

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

isDDL and removeStatementHint panic with invalid query
2 participants