-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: negative scale in pgwire binary decimal format crashes node #158884
Copy link
Copy link
Closed
Labels
A-sql-pgcompatSemantic compatibility with PostgreSQLSemantic compatibility with PostgreSQLC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.E-quick-winLikely to be a quick win for someone experienced.Likely to be a quick win for someone experienced.S-3Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)T-sql-queriesSQL Queries TeamSQL Queries Teambranch-release-25.4Used to mark GA and release blockers and technical advisories for 25.4Used to mark GA and release blockers and technical advisories for 25.4branch-release-26.1Used to mark GA and release blockers, technical advisories, and bugs for 26.1Used to mark GA and release blockers, technical advisories, and bugs for 26.1target-release-26.2.0v26.1.0-prereleasev26.2.0-prerelease
Description
With the following test case in TestPGTest:
send
Parse {"Name": "s1", "Query": "SELECT $1::decimal"}
Bind {"DestinationPortal": "p1", "PreparedStatement": "s1", "ParameterFormatCodes": [1], "Parameters": [{"binary":"000100010000FFF00001"}]}
Execute {"Portal": "p1"}
Sync
----
until
ReadyForQuery
----
And running that test against an active CRDB node:
./dev test pkg/sql/pgwire -f TestPGTest/_tmp --test-args "-addr=localhost:26257 -user=root"
You can crash the node with a slice out-of-bounds panic. The crash happens because the decimal decoding logic doesn't know how to handle a negative scale (the FFF0 part).
Jira issue: CRDB-57539
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-pgcompatSemantic compatibility with PostgreSQLSemantic compatibility with PostgreSQLC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.E-quick-winLikely to be a quick win for someone experienced.Likely to be a quick win for someone experienced.S-3Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)T-sql-queriesSQL Queries TeamSQL Queries Teambranch-release-25.4Used to mark GA and release blockers and technical advisories for 25.4Used to mark GA and release blockers and technical advisories for 25.4branch-release-26.1Used to mark GA and release blockers, technical advisories, and bugs for 26.1Used to mark GA and release blockers, technical advisories, and bugs for 26.1target-release-26.2.0v26.1.0-prereleasev26.2.0-prerelease
Type
Projects
Status
Done