Skip to content

fix: add missing output pointer validation in array schema conversion functions#5787

Merged
teo-tsirpanis merged 1 commit intoTileDB-Inc:mainfrom
nickvigilante:fix/output-pointer-validation-array-schema
Mar 27, 2026
Merged

fix: add missing output pointer validation in array schema conversion functions#5787
teo-tsirpanis merged 1 commit intoTileDB-Inc:mainfrom
nickvigilante:fix/output-pointer-validation-array-schema

Conversation

@nickvigilante
Copy link
Copy Markdown
Contributor

@nickvigilante nickvigilante commented Mar 27, 2026

Summary

Four public C API functions in array_schema_api.cc dereference their output pointer parameters without first validating them. Passing null for any of these output pointers causes a segfault rather than returning TILEDB_ERR:

  • tiledb_array_type_to_str
  • tiledb_array_type_from_str
  • tiledb_layout_to_str
  • tiledb_layout_from_str

The 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

  • Confirm existing array schema C API tests still pass
  • Manually verify that passing null to each affected function now returns TILEDB_ERR instead of segfaulting

🤖 Generated with Claude Code


TYPE: IMPROVEMENT
DESC: Added extra null pointer validation for a couple of APIs.

… 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).
Copy link
Copy Markdown
Member

@teo-tsirpanis teo-tsirpanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These APIs are rarely if ever used, but sure.

@teo-tsirpanis
Copy link
Copy Markdown
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.

@nickvigilante
Copy link
Copy Markdown
Contributor Author

You got it. Claude built it from my fork, so that's why it's failing.

@teo-tsirpanis teo-tsirpanis merged commit fbe88b4 into TileDB-Inc:main Mar 27, 2026
56 of 58 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