Skip to content

Fix null pointer passed to memcpy/memcmp for empty str/bin objects. - #1231

Merged
redboltz merged 1 commit into
msgpack:cpp_masterfrom
redboltz:fix_object_zone_copy
Nov 20, 2026
Merged

redboltz merged 1 commit into
msgpack:cpp_masterfrom
redboltz:fix_object_zone_copy

Conversation

@redboltz

Copy link
Copy Markdown
Contributor

An empty str or bin decoded from the wire can carry a null data pointer. Copying such an object into another zone (msgpack::object(obj, zone)) called memcpy with a null source, and comparing it called memcmp with a null argument. Both are undefined behavior and are reported by UBSan. Skip the copy and the comparison when the size is zero.

An empty str or bin decoded from the wire can carry a null data pointer.
Copying such an object into another zone (msgpack::object(obj, zone))
called memcpy with a null source, and comparing it called memcmp with a
null argument. Both are undefined behavior and are reported by UBSan.
Skip the copy and the comparison when the size is zero.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.04%. Comparing base (39cc081) to head (64473c2).
⚠️ Report is 48 commits behind head on cpp_master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@              Coverage Diff               @@
##           cpp_master    #1231      +/-   ##
==============================================
- Coverage       85.36%   80.04%   -5.33%     
==============================================
  Files              80       80              
  Lines            5099     5832     +733     
  Branches          507      645     +138     
==============================================
+ Hits             4353     4668     +315     
- Misses            746     1164     +418     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@redboltz
redboltz merged commit b0ca937 into msgpack:cpp_master Nov 20, 2026
25 checks passed
@redboltz
redboltz deleted the fix_object_zone_copy branch November 20, 2026 12:44
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