OSDN Git Service

AArch64: AString::append for longs and pointers
authorMarcus Oakland <marcus.oakland@arm.com>
Tue, 25 Mar 2014 17:32:00 +0000 (17:32 +0000)
committerAshok Bhat <ashok.bhat@arm.com>
Tue, 15 Apr 2014 12:58:18 +0000 (13:58 +0100)
commitef80764db37aa00bbb88755cb6cf11c6f2720bd3
tree2adc4fe23addd6229400624ecb760a44744b42d7
parent9829344d526f87ca745208f04216ec795b239581
AArch64: AString::append for longs and pointers

The AString::append methods for long, unsigned long and void *
pointers were using char arrays of 16 elements, which were not long
enough for 64-bit longs and pointers in __LP64__ systems. This
resulted in "FORTIFY_SOURCE: vsprintf: prevented write past end of
buffer. Calling abort()." when the
android.media.cts.DecoderTest#testFlush CTS test was run.

The AString::append methods that were using sprintf have been modifed
to use snprintf instead, taking the sizeof the "s" array (which has
been made 32 char without conditional compilation for __LP64__ where
appropriate), and checking the return value to ensure that the string
has not been truncated.

After this change and changes to the types of OMX_U32 and OMX_S32 in the
frameworks/native/include/media/openmax/OMX_Types.h header file, the
android.media.cts.DecoderTest#testFlush CTS test passes.

Change-Id: I76d897373473c82f52986f43a15b050b844a370a
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
media/libstagefright/foundation/AString.cpp