host resource memcpy undefined behavior
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 107
- Forks
- 26
- Avg merge
- 8d 11h
- Merged PRs (30d)
- 2
Description
In playing with undefined behavior sanitizer I learned that it is undefined behavior to pass a nullptr to std::memcpy even if the count/size argument is 0, see https://en.cppreference.com/w/cpp/string/byte/memcpy.
Do we want to allow users to pass nullptr to camp::resources::Host::memcpy with a count/size of 0?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at camp::resources::Host::memcpy and inspect how zero-length calls reach std::memcpy. Determine the intended contract for nullptr with a zero count, then add focused coverage for that behavior. Done means the API decision is documented in tests and sanitizer checks no longer report the case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100