Inconsistent behaviour between utf16_to_utf8 and utf16_to_utf8_length
is causing a heap overflow.
Correcting the length computation and adding bound checks to the
conversion functions.
Test: ran libutils_tests
Bug: 29250543
Change-Id: I6115e3357141ed245c63c6eb25fc0fd0a9a7a2bb
(cherry picked from commit c4966a363e)
Inconsistent behaviour between utf16_to_utf8 and utf16_to_utf8_length
is causing a heap overflow.
Correcting the length computation and adding bound checks to the
conversion functions.
(cherry picked from commit c4966a363e)
(changed code for safetynet logging due to lack of sstream and string in klp)
Change-Id: If50d59a91a13fddbff9a8fff0d3eebe57c711e93
Bug: 29250543
Add a build id field to the header structure in blob cache. Add build
id support with reading and writing the cache. When the cache gets
written it writes the build id at the end of the header. When read it
checks to see if there is a match between the current version and the
version in the cache. If not, it invalidates the cache which would
typically only occur during an ota update. Also remove blob cache
from the host build.
bug: 18262905
Change-Id: I753b1de1986703a4c1c8691b9d2bb533b2546143
When a file descriptor is closed before removing it from the
epoll set, it will normally be removed automatically from the
epoll set by the kernel. However if there exists a duplicate
then the original file descriptor may remain in the set and
continue to receive events until all duplicates have been closed.
Unfortunately due to kernel limitations we need to rebuild the epoll
set from scratch because it may contain an old file handle that we are
now unable to remove since its file descriptor is no longer valid.
No such problem would have occurred if we were using the poll system
call instead, but that approach carries others disadvantages.
Bug: 19715279
Change-Id: If1ab8ebda0825755a416d513e888942a02ee3948
Added code to protect against situations that may occur when a
Looper callback has the side-effect of closing the file descriptor that
it is watching before it returns. This code pattern is very
convenient for implementation but it does expose issues in how
the list of callbacks is maintained. In particular, we
need to watch out for file descriptors which have been reused.
This change may resolve previously unexplained ANRs associated with
log messages such as: "Error modifying epoll events for fd 44, errno=2"
Bug: 10349083
Change-Id: I20eedf6ffbdeda382653ca0104962505194741b0
The loop isn't technically idle at this time, it's just checking
whether any file descriptors have pending events. However it's
still a good signal as to whether the loop is alive.
Bug: 19532373
Change-Id: I555c473e70ffd8a56e1b10aa60026eb674a16de9
Nobody ever called acquire() so release() was always
equivalent to delete. Just use delete instead so that
people can use unique_ptr directly (or shared_ptr if
they really want refcounts).
Change-Id: I9e3ad5e0f6a4fcc4e02e5a2ff7ef9514fe234415
This isn't particularly useful in and of itself, but it does introduce the
first (trivial) unit test, improves the documentation (including details
about how to debug init crashes), and made me aware of how unpleasant the
existing parser is.
I also fixed a bug in passing --- unless you thought the "peboot" and "pm"
commands were features...
Bug: 19217569
Change-Id: I6ab76129a543ce3ed3dab52ef2c638009874c3de
system/core/include/utils/Mutex.h:134:25: error: non-constant-expression
cannot be narrowed from type 'long long' to '__kernel_time_t' (aka
'long') in initializer list [-Wc++11-narrowing]
system/core/include/utils/Mutex.h:135:26: error: non-constant-expression
cannot be narrowed from type 'long long' to 'long' in initializer list
[-Wc++11-narrowing]
Change-Id: Icb9df26aeb01617da5ab1c36987289f7c2b11954
This is not available for host builds because OSX doesn't have
pthread_mutex_timedlock() or equivalent.
Bug: 18842510
Change-Id: I072e74ab1a6f770fd245828b39c5f954dda1113b
The ANDROID_SINGLETON_STATIC_INSTANCE is used in some files
out of the android namespace. If it does not use full qualified
names, users of this macro will need to use it inside the 'android'
namespace to avoid warnings from clang compiler.
Change-Id: Ie4d4ba2b57fdc72d0deb3b7c2326304a44a1300f
As well intentioned as these were, uint16_t and C++11's char16_t are
_not_ actually compatible. They are not implicitly convertible, and
they mangle differently, so they are not even ABI compatible. In our
now wonderous world of C++11, no one should be using these, so just
kill them.
Bug: 18300613
Change-Id: I06d92d7f1d937dd94a620874323d4c50eb6a31bd
Needed for cases where something should be constexpr if possible, but
not being constexpr is fine if in pre-C++11 code (such as a const
static float member variable).
Bug: 18466763
Change-Id: I635d062575ba2fbc4cbe3a89f730128c404d95e1
Files that included FileMap.h (possibly transitively), before including
ByteOrder.h (which pulls in winsock2.h directly), will experience a
compiler warning/error from the latest mingw headers. This happens because
the headers require that winsock2.h come before windows.h in all cases.
The simplest (and most error-proof) fix for now is to include winsock2.h
before this use of windows.h.
Change-Id: I33069e4c9962d9820d0ea5976554f89d7ff6307c