possible invalid usage of realloc
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 338
- Forks
- 35
- Avg merge
- 13h 41m
- Merged PRs (30d)
- 3
Description
Here:
operator new/delete defined as:
static void* operator new(size_t size, unsigned capacity) {
return ::operator new(size + capacity*sizeof(NodeRef));
}
but then
MutableInterior* grow() {
assert_precondition(capacity() < kMaxChildren);
auto replacement = (MutableInterior*)realloc(this,
should be malloc/free used instead of ::operator new in the first place,
to make it possible to use realloc here?
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 Fleece/Tree/MutableNode.hh around the linked operator new/delete definitions and MutableInterior::grow(). Check whether the allocation and deallocation methods are compatible with realloc, then verify the appropriate ownership behavior for growth. Done means resolving whether this usage is valid and making the allocation strategy consistent if it is not.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100