History log of /system/chre/util/include/chre/util/memory.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
97156830527953070044eed8b0eb42ba689c53c4 28-Aug-2017 Andrew Rossignol <aarossig@google.com> Makes UniquePtr, DynamicVector and FlatBuffers portable

- They are now usable when compiled as part of an external nanoapp.

Bug: 62868460
Bug: 65119819
Test: ./load_chre.sh and basic CHRE sanity check
Change-Id: I1c6f9047bae0b9fdd2d99062b29784da8fd256eb
/system/chre/util/include/chre/util/memory.h
8be5eabe6a4fc60c56a3b32794bb6677e26f6eab 27-Mar-2017 Brian Duddie <bduddie@google.com> Fix incorrect usage of assignment, move in containers

Containers like DynamicVector were using the assignment operator in
multiple places to initialize memory. This is not valid, as assignment
assumes that the receiving object has already been constructed. This
manifested in use of DynamicVector<UniquePtr>, where UniquePtr's move
assignment operator would call memoryFree on its pointer if not null -
if its pointer was some non-zero uninitialized memory, this would lead
to memory corruption and a likely crash.

Resolve this issue by correcting all instances where assignment was used
on uninitialized memory to use placement new to properly construct these
objects. Also, make updates to places where containers assumed that
move/copy assignment/construction was supported by the contained type to
check that condition and select the appropriate option.

Finally, fix the tests that were written with the assumption that
certain operations would use assignment when they should have used
construction, and also increase overall test coverage to ensure this
issue does not recur.

Test: run tests and simulator with valgrind
Change-Id: Ia2803ab78a02065acab384e536c3259a52f7c863
/system/chre/util/include/chre/util/memory.h