fix: add missing output pointer validation in array schema conversion functions#5787
Merged
teo-tsirpanis merged 1 commit intoTileDB-Inc:mainfrom Mar 27, 2026
Conversation
… functions Four public C API functions dereferenced their output pointer parameters without first validating them, causing a segfault if a caller passed null: - tiledb_array_type_to_str - tiledb_array_type_from_str - tiledb_layout_to_str - tiledb_layout_from_str Add ensure_output_pointer_is_valid() to each, consistent with the pattern used throughout the rest of the C API (e.g. tiledb_array_schema_alloc on the line immediately following these functions in the same file).
teo-tsirpanis
approved these changes
Mar 27, 2026
Member
teo-tsirpanis
left a comment
There was a problem hiding this comment.
These APIs are rarely if ever used, but sure.
Member
|
REST CI is failing because the PR is from a fork, but the PR is trivial so we don't need REST CI. If you want to make a more substantial PR in the future, please create a branch in this repository. |
Contributor
Author
|
You got it. Claude built it from my fork, so that's why it's failing. |
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.
Summary
Four public C API functions in
array_schema_api.ccdereference their output pointer parameters without first validating them. Passingnullfor any of these output pointers causes a segfault rather than returningTILEDB_ERR:tiledb_array_type_to_strtiledb_array_type_from_strtiledb_layout_to_strtiledb_layout_from_strThe fix adds
ensure_output_pointer_is_valid()to each function, matching the pattern used throughout the rest of the C API. The function immediately following these four in the same file (tiledb_array_schema_alloc) already uses this validation correctly.Test plan
nullto each affected function now returnsTILEDB_ERRinstead of segfaulting🤖 Generated with Claude Code
TYPE: IMPROVEMENT
DESC: Added extra null pointer validation for a couple of APIs.