Fix decode crash on a NULL scalar OUT bind from a PL/SQL block (#205)#206
Merged
Conversation
A PL/SQL block / callproc / callfunc with a scalar OUT bind that returns
NULL crashed the response decoder ("Can't decode unknown type"). In the
IOV OUT-value decode (_read_iov), the per-value return code is a
variable-length integer, not a fixed byte: a non-NULL value's code is
ub4(0) = one 0x00 byte (so the old fixed 1-byte skip happened to work),
but a NULL value's is ub4(-1) = 0x81 0x01 (two bytes). Skipping a fixed
byte left a stray byte and desynced the decoder on the next token.
Consume the return code with decode_ub4 (both the scalar and the
associative-array element paths). Verified on 9i/10g/11g/21c/23ai.
Surfaced while building SODA (#200): SODA documents have NULL fields
(e.g. created_on / last_modified on a default collection).
Closes #205
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
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.
A PL/SQL block /
callproc/callfuncwith a scalar OUT bind that comes back NULL crashed the response decoder:Cause: in
_read_iovthe per-value return code is a variable-length integer, not a fixed byte. A non-NULL value's code isub4(0)= one0x00byte (so the old fixed 1-byte skip happened to work), but a NULL value's isub4(-1)=0x81 0x01(two bytes). Skipping a fixed byte left a stray byte and desynced the decoder.Fix: consume the return code with
decode_ub4(scalar + associative-array element paths).Tests: new
test_null_scalar_out_bind(mixed NULL/non-NULL OUT binds + a lone NULL OUT). OUT-bind suites — callproc, assoc-array #122 — green on 9i/10g/11g/21c/23ai; offline 522.Pre-existing bug; surfaced while building SODA (#200), whose documents have NULL fields (created_on / last_modified on a default collection).
Closes #205
🤖 Generated with Claude Code