Skip to content

Conversation

@SajanGhimire1
Copy link

CRITICAL FIXES:

  1. Fixed NULL pointer dereference in SystemLocale::NextChar()

    • Added NULL check to prevent crash when start pointer is NULL
    • Prevents DoS attack via malformed encoding input
  2. Fixed uninitialized pointer return in IConvCachePool::Borrow()

    • Explicitly set pCache to NULL after failed allocation
    • Prevents undefined behavior and potential memory corruption
    • Eliminates use-after-free/information disclosure risk

These memory safety vulnerabilities affect the SQL Server PHP driver when handling user-provided data with specific encoding conditions.

SajanGhimire1 and others added 2 commits January 9, 2026 08:05
CRITICAL FIXES:
1. Fixed NULL pointer dereference in SystemLocale::NextChar()
   - Added NULL check to prevent crash when start pointer is NULL
   - Prevents DoS attack via malformed encoding input

2. Fixed uninitialized pointer return in IConvCachePool::Borrow()
   - Explicitly set pCache to NULL after failed allocation
   - Prevents undefined behavior and potential memory corruption
   - Eliminates use-after-free/information disclosure risk

These memory safety vulnerabilities affect the SQL Server PHP driver
when handling user-provided data with specific encoding conditions.
@jahnvi480
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jahnvi480
Copy link
Contributor

@SajanGhimire1 Thanks for raising the PR for this fix, Can you please check why is the pipeline failing for all OSs and fix it, also I would like you to add some tests to check if the code that you have added really works.

@jahnvi480
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Added a NULL pointer check in NextChar to prevent crashes.
@SajanGhimire1
Copy link
Author

@SajanGhimire1 Thanks for raising the PR for this fix, Can you please check why is the pipeline failing for all OSs and fix it, also I would like you to add some tests to check if the code that you have added really works.

@jahnvi480 I’ve added the NULL pointer check in NextChar() and explicitly set pCache = NULL in IConvCachePool::Borrow(). These changes fix the memory safety issues and don’t alter any other logic.

@jahnvi480
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jahnvi480
Copy link
Contributor

@SajanGhimire1 MacOs and Linux tests are failing can you check on this
https://sqlclientdrivers.visualstudio.com/public/_build/results?buildId=136656&view=logs&j=a5e52b91-c83f-5429-4a68-c246fc63a4f7&t=5852bf5a-5a02-52f3-bee8-4fdc90cda9d0

@SajanGhimire1
Copy link
Author

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