fix(pg-protocol): read ParameterDescription type OIDs as unsigned - #3728
Open
pratik-desgn wants to merge 1 commit into
Open
fix(pg-protocol): read ParameterDescription type OIDs as unsigned#3728pratik-desgn wants to merge 1 commit into
pratik-desgn wants to merge 1 commit into
Conversation
parseField() already reads dataTypeID as uint32 for RowDescription (with a regression test covering OIDs above 2^31-1), but parseParameterDescriptionMessage() was still using the signed int32 reader for the same kind of value, so custom extension types with a high OID would come back negative in ParameterDescriptionMessage.dataTypeIDs.
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.
While digging into #2974 (custom-type OIDs above the int4 range not parsing correctly), I found that path is actually already fixed —
parseField()inpg-protocol's parser readsdataTypeIDwithreader.uint32(), and there's already a regression test (bigOidDescBuff/expectedBigOidMessage) covering an OID over 2^31-1 in RowDescription.parseParameterDescriptionMessage()never got the same fix though. It still reads each entry indataTypeIDswith the signedreader.int32(), so a prepared statement parameter whose type OID exceeds 2^31-1 (custom extension types can get OIDs that high) comes back as a negative number instead of the real OID.This mirrors the RowDescription fix exactly: swap
int32()foruint32(), and add the same kind of big-OID regression test for ParameterDescription that already exists for RowDescription. Confirmed the new test fails on the old code (asserts a negative dataTypeID) and passes with the fix; fullpg-protocolsuite (78 tests) is green.