Commit f9acc07
authored
FIX: S360 Resolve [CodeQL.SM02986] 'Cast from char* to wchar_t* (microsoft#309)
### Work Item / Issue Reference
<!--
IMPORTANT: Please follow the PR template guidelines below.
For mssql-python maintainers: Insert your ADO Work Item ID below (e.g.
AB#37452)
For external contributors: Insert Github Issue number below (e.g. microsoft#149)
Only one reference is required - either GitHub issue OR ADO Work Item.
-->
<!-- mssql-python maintainers: ADO Work Item -->
>
[AB#40019](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/40019)
[AB#40020](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/40020)
<!-- External contributors: GitHub Issue -->
> GitHub Issue: #<ISSUE_NUMBER>
-------------------------------------------------------------------
### Summary
<!-- Insert your summary of changes below. Minimum 10 characters
required. -->
This pull request adds explanatory comments to several
`reinterpret_cast` statements in the `FetchLobColumnData` function
within `mssql_python/pybind/ddbc_bindings.cpp`, clarifying the safety of
these casts for CodeQL static analysis. The comments explain why casting
from `std::vector` data to wide character pointers is safe in this
context.
Code safety and documentation improvements:
* Added detailed comments to `reinterpret_cast<const
SQLWCHAR*>(chunk.data())` and similar casts, explaining alignment
guarantees and safe usage for CodeQL [SM02986] in both Windows and
Linux/macOS code paths.
[[1]](diffhunk://#diff-dde2297345718ec449a14e7dff91b7bb2342b008ecc071f562233646d71144a1L2406-R2408)
[[2]](diffhunk://#diff-dde2297345718ec449a14e7dff91b7bb2342b008ecc071f562233646d71144a1L2437-R2449)
<!--
### PR Title Guide
> For feature requests
FEAT: (short-description)
> For non-feature requests like test case updates, config updates ,
dependency updates etc
CHORE: (short-description)
> For Fix requests
FIX: (short-description)
> For doc update requests
DOC: (short-description)
> For Formatting, indentation, or styling update
STYLE: (short-description)
> For Refactor, without any feature changes
REFACTOR: (short-description)
> For release related changes, without any feature changes
RELEASE: #<RELEASE_VERSION> (short-description)
### Contribution Guidelines
External contributors:
- Create a GitHub issue first:
https://github.com/microsoft/mssql-python/issues/new
- Link the GitHub issue in the "GitHub Issue" section above
- Follow the PR title format and provide a meaningful summary
mssql-python maintainers:
- Create an ADO Work Item following internal processes
- Link the ADO Work Item in the "ADO Work Item" section above
- Follow the PR title format and provide a meaningful summary
-->1 parent 622f95b commit f9acc07
1 file changed
+13
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
2463 | 2464 | | |
2464 | 2465 | | |
2465 | 2466 | | |
2466 | | - | |
2467 | | - | |
| 2467 | + | |
2468 | 2468 | | |
2469 | | - | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
2470 | 2472 | | |
2471 | 2473 | | |
2472 | 2474 | | |
| |||
2495 | 2497 | | |
2496 | 2498 | | |
2497 | 2499 | | |
2498 | | - | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
2499 | 2504 | | |
2500 | 2505 | | |
2501 | 2506 | | |
2502 | 2507 | | |
2503 | 2508 | | |
2504 | | - | |
2505 | | - | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
2506 | 2512 | | |
2507 | 2513 | | |
2508 | 2514 | | |
| |||
2623 | 2629 | | |
2624 | 2630 | | |
2625 | 2631 | | |
2626 | | - | |
2627 | | - | |
| 2632 | + | |
2628 | 2633 | | |
2629 | 2634 | | |
2630 | 2635 | | |
| |||
0 commit comments