Skip to content

test: add test_null_pointer_safety for exhaustive NULL API boundary c…#35

Merged
ionux merged 1 commit intomainfrom
claude/test-null-pointer-safety-K4FVD
Mar 12, 2026
Merged

test: add test_null_pointer_safety for exhaustive NULL API boundary c…#35
ionux merged 1 commit intomainfrom
claude/test-null-pointer-safety-K4FVD

Conversation

@ionux
Copy link
Copy Markdown
Owner

@ionux ionux commented Mar 12, 2026

…overage

Extends the existing test_parse_null_parser with a new test that covers all remaining public API entry points against NULL pointer arguments:

  • okj_init(NULL, json) — must be a silent no-op
  • okj_init(parser, NULL) — must leave parser fields unmodified
  • okj_count_objects(NULL) — must return 0U
  • okj_count_arrays(NULL) — must return 0U
  • okj_count_elements(NULL) — must return 0U

Implements the MISRA C defensive-programming principle that every API boundary must validate pointer arguments before dereferencing them.

https://claude.ai/code/session_011gskL1pHp41xm2oUh9fMhE

…overage

Extends the existing test_parse_null_parser with a new test that covers
all remaining public API entry points against NULL pointer arguments:

- okj_init(NULL, json)     — must be a silent no-op
- okj_init(parser, NULL)   — must leave parser fields unmodified
- okj_count_objects(NULL)  — must return 0U
- okj_count_arrays(NULL)   — must return 0U
- okj_count_elements(NULL) — must return 0U

Implements the MISRA C defensive-programming principle that every API
boundary must validate pointer arguments before dereferencing them.

https://claude.ai/code/session_011gskL1pHp41xm2oUh9fMhE
@ionux ionux merged commit 8e1a4ef into main Mar 12, 2026
2 checks passed
@ionux ionux deleted the claude/test-null-pointer-safety-K4FVD branch March 12, 2026 02:31
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