History log of /system/core/libutils/VectorImpl.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6b667fddeb871338ac7b42d2a005f3d933004e15 28-Aug-2015 Narayan Kamath <narayan@google.com> libutils: Fix integer overflows in VectorImpl.

Use external/safe-iop to check for overflows on arithmetic
operations.

Also remove an unnecessary copy of Vector/SharedBuffer from
codeflinger and use the copy from libutils instead.

Note that some of the unit tests are somewhat useless due to
test-runner limitations : gtest's ability to filter on abort message
doesn't work when combined with messages formatted by android's logging
system.

bug: 22953624

Change-Id: I46b1ae8ca1f3a010be13aca36a091e76a97a7b70
/system/core/libutils/VectorImpl.cpp
eb0eb4f79fca083009aa7a6b6e28ddcdbcbd1214 17-Oct-2013 Shuo Gao <shuo.gao@intel.com> fix corruption in Vector<> when malloc falied

1. When alloc or realloc failed in the function SharedBuffer::editResize,
it would return a NULL pointer, then mStorage would update to be 1 by
SharedBuffer::data() if no pointer check here, which is an obviously
wrong address, and would cause corruption when used it e.g. in capacity().

So add the pointer check here for the return value of SharedBuffer::editResize,
if it's NULL do not use it to update mStorage, to avoid the value of mStorage
polluted.

2. when alloc or realloc falied in _grow & _shrink function, mStorage keep
the original value, so mCount should not be updated here.

Otherwise, mStorage might be 0 but mCount>0, so a corruption would happend
when it try to delete items from the Vector since mCount>0.

Change-Id: I7c3814e843c459834ca5eed392e8d63d1cb7d2d8
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Jian Luo <jian.luo@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 139626
/system/core/libutils/VectorImpl.cpp
d98e07fdf9c338589f263c47ce5c844ed43efad5 02-Aug-2013 Alex Ray <aray@google.com> move libs/utils to libutils

Change-Id: I6cf4268599460791414882f91eeb88a992fbd29d
/system/core/libutils/VectorImpl.cpp