summaryrefslogtreecommitdiff
path: root/libutils/VectorImpl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* libutils: clearer abort on overflow.Elliott Hughes2022-04-281-8/+6
| | | | | | | | | | | | | | Let's turn a bug into a feature... Since this code is built with intsan, anyone who caused overflow here will have had an abort, so we know no-one actually needs the BAD_INDEX return that was presumably the original author's intent. So let's just mandate that, since it's a lot harder to ignore an abort than it is to ignore an error return. Bug: http://b/179044558 Test: treehugger Change-Id: I08f1018f9da1e09de885699138b7543d55bb2a36 (cherry picked from commit a5f2e4d421fa50c5e7fe3f7dc4a98e1e97ddfc74) Merged-In: I08f1018f9da1e09de885699138b7543d55bb2a36
* Move system/core/ off NO_ERROR.Elliott Hughes2018-10-081-9/+8
| | | | | | | | It causes trouble for Windows, and OK already exists. Bug: N/A Test: builds Change-Id: Ida22fd658b0ebb259c710ba39049b07c9e495d9c
* Move off safe-iop.Elliott Hughes2018-08-281-10/+9
| | | | | | Bug: http://b/25224572 Test: ran tests Change-Id: I6687015eedb28c69d1f57c9d3cd7324d4995e47a
* [libutils] Modernize codebase by replacing NULL with nullptrYi Kong2018-07-161-17/+17
| | | | | | | | Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5e89ec8c42151875439d2656475a8739ab9cb7dc
* clean-up libutils includesMathias Agopian2017-03-031-2/+2
| | | | | | | | | | | | moved Foo.h as first include of Foo.cpp, and removed redundant includes. Made NativeHandle non virtual. Test: run & compile Bug: n/a Change-Id: I37fa746cd42c9ba23aba181f84cb6c619386406a
* liblog: use log/log.h when utilizing ALOG macrosMark Salyzyn2017-01-111-1/+1
| | | | | | Test: compile Bug: 30465923 Change-Id: Id6d76510819ebd88c3f5003d00d73a0dbe85e943
* system/core Replace cutils/log.h with android/log.hMark Salyzyn2016-09-301-5/+5
| | | | | | | | | | | Should use android/log.h instead of cutils/log.h as a good example to all others. Adjust header order to comply with Android Coding standards. Test: Compile Bug: 26552300 Bug: 31289077 Change-Id: I2c9cbbbd64d8dccf2d44356361d9742e4a9b9031
* am f777655d: resolved conflicts for 6ee734cf to stage-aosp-masterSergio Giro2015-09-231-1/+2
|\ | | | | | | | | * commit 'f777655d85af3aefa4a1683f289da1ec67988330': libutils: hide SharedBuffer by moving SharedBuffer.h to the implementation directory
| * libutils: hide SharedBuffer by moving SharedBuffer.h to the implementation ↵Sergio Giro2015-09-231-1/+2
| | | | | | | | | | | | | | | | | | directory Some methods in header files of classes using SharedBuffer need to be moved to the implementation files accordingly Change-Id: I891f3ace2b940ab219e4e449040bfed71c0547db
* | resolved conflicts for 32d86587 to mnc-dr-dev-plus-aospNarayan Kamath2015-09-081-23/+59
|\ \ | |/ |/| | | Change-Id: I381133e7dd93f908bd3d2b42e8af83d954e428af
| * libutils: Fix integer overflows in VectorImpl.Narayan Kamath2015-09-021-23/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | VectorImpl.cpp: fix benign multiplication overflowNick Kralevich2015-08-281-1/+4
| | | | | | | | | | | | | | | | | | | | j is a ssize_t, which can go negative. If it goes negative, the resulting multiplication of mItemSize*j doesn't make any sense. Since the value is never used, just don't perform the calculation if j < 0. Bug: 23607865 Change-Id: I14f6f6506645d582f7d67a2e2d60ead3cb18b957
* | libutils: cleanups for -fsanitize=integerNick Kralevich2015-08-241-0/+4
|/ | | | | | | | | | | | | | * Hashing functions rely on integer overflow behavior. Mark those functions as safe. * abort() if a passed in size_t value is greater than UINT32_MAX. This can occur on 64 bit builds where size_t is larger than uint32_t. * Special case the index lookup for an empty sorted vector. Without the special case, size() == 0, and size()-1 underflows. Change-Id: I343a14b589fc8f0d221c1998ae5d6f0b9e2781f8
* fix corruption in Vector<> when malloc faliedShuo Gao2013-10-301-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | 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
* move libs/utils to libutilsAlex Ray2013-08-021-0/+625
Change-Id: I6cf4268599460791414882f91eeb88a992fbd29d