Repository navigation
Conversation
valgrind catch in rather old couchbase-lite-core write of 8 bytes
to place, for each was allocated only 4.
So that's why this fix.
Plus I suppose it is C++ standard violation to allocate less them sizeof(type):
```
The lifetime of an object of type T begins when:
(2.1)
storage with the proper alignment and size for type T is obtained
```
|
The best fix would be to change the size of |
I suppose at least with modern gcc there is misbehaviour. valgrind catch write of 8 bytes by pointer that point to 4 bytes allocation.
I suppose this is change nothing is modern allocators, where minimal bucket size is 8 bytes, |
Are you sure? I think valgrind is complaining that
The allocator will let you get away with this, but AddressSanitizer will catch writing even 1 byte past the size passed to malloc. That's why I don't think there is any problem at runtime. |
Yes, here is relevant part of valgrind's log:
Yeah, but I catched this bug only on network exchange, so real users, that build code obviously without AddressSanitizer, can not see this bug, even if it exists, because of allocator gives them 8, 16 or more bytes. But the main point, that |
valgrind catch in rather old couchbase-lite-core write of 8 bytes to place, for each was allocated only 4.
So that's why this fix.
Plus I suppose it is C++ standard violation to allocate less them sizeof(type):