Skip to content

Fix Polaris scan issues in Unicode conversion and parameter binding - #1081

Merged
bimalkjha merged 1 commit into
ibmdb:masterfrom
Earammak:polaris_fix
Oct 29, 2026
Merged

bimalkjha merged 1 commit into
ibmdb:masterfrom
Earammak:polaris_fix

Conversation

@Earammak

Copy link
Copy Markdown
Collaborator

Summary

This PR addresses Polaris scan issues related to memory allocation safety and parameter binding initialization.

Changes

Prevent integer overflow during UTF-16 buffer allocation

  • Added validation before calculating SQLWCHAR allocation size.
  • Prevents overflow when allocating buffers for large UTF-16 strings.
  • Raises OverflowError when input size exceeds supported limits.

Handle UTF-16 allocation failures safely

  • Added NULL checks after memory allocation.
  • Raises appropriate Python memory exceptions.
  • Ensures allocated Python objects are cleaned up correctly before returning.

Fix parameter binding initialization issues

  • Initialized rc and paramValuePtr variables to safe default values.
  • Assigned paramValuePtr immediately after buffer allocation in array binding paths.
  • Prevents use of uninitialized or invalid pointers during parameter binding operations.

@Earammak
Earammak requested a review from bimalkjha October 29, 2026 10:39
@bimalkjha
bimalkjha merged commit 88e8b25 into ibmdb:master Oct 29, 2026
8 checks passed
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.

2 participants