Skip to content

allow NULL empty blocks in blk2bstr - #220

Open
rdmark wants to merge 1 commit into
mainfrom
219-inconvenient-that-blk2bstr-doesnt-accept-null-pointer-when-size-is-0
Open

allow NULL empty blocks in blk2bstr#220
rdmark wants to merge 1 commit into
mainfrom
219-inconvenient-that-blk2bstr-doesnt-accept-null-pointer-when-size-is-0

Conversation

@rdmark

@rdmark rdmark commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Treat a NULL source pointer as valid when len is zero, since no source memory is read and the result is an ordinary empty bstring. Keep negative lengths and NULL pointers paired with a positive length as errors.

Document the contract in the public header, and cover the accepted form with the core unit test.

Thanks to @DamjanJovanovic for the report

Treat a NULL source pointer as valid when len is zero, since no source memory is read and the result is an ordinary empty bstring. Keep negative lengths and NULL pointers paired with a positive length as errors.

Document the contract in the public header, and cover the accepted form with the core unit test.

Thanks to @DamjanJovanovic for the report
@rdmark
rdmark requested a review from msteinert as a code owner August 4, 2026 21:42
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

File Coverage Lines Branches
All files 69% 74% 63%
bstring/bstraux.c 55% 64% 47%
bstring/bstrlib.c 74% 78% 71%
bstring/buniutil.c 80% 86% 73%
bstring/utf8util.c 60% 71% 50%

Minimum allowed coverage is 50%

Generated by 🐒 cobertura-action against 85a5247

@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

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.

Inconvenient that blk2bstr() doesn't accept NULL pointer when size is 0

1 participant