Go to file
Nick Kralevich 58ba58a97c logd: Don't embed a flexible array member within another struct
C (but not C++) has a concept of a flexible array member, which
is documented at https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html .
Using a flexible array member indicates that the structure is
really a header for a variable length object.

In logd's case, the variable length structure android_event_string_t
was embedded within another structure called
android_log_event_string_t. This makes gcc's __builtin_object_size()
function really confused. When compiling with C++,
__builtin_object_size(android_log_event_string_t.payload.data, 1)
would return 0, whereas if you compiled the code with C, the same
call would (properly) return -1.

Code which does automatic bounds checking, such as the proposed
patch at https://android-review.googlesource.com/145411 , will
cause problems for logd if this syntax is used.

Don't try to embed a variable length structure within another
structure. This doesn't appear to be valid C nor C++, and
while it's worked, it seems problematic.

Instead, inline the structure so it's one big happy structure.

Change-Id: I8ac02b7142a4f6560f5f80df2effcf720f9896fc
2015-04-07 10:12:20 -07:00
adb Merge "Set verity mode as the verified property value" 2015-04-07 08:45:24 +00:00
adf libadf: enable -Werror 2015-03-10 15:14:38 -07:00
base Cleanup base/logging. 2015-04-03 16:49:55 -07:00
cpio mkbootfs: move fs_config to libcutils 2015-04-02 10:19:43 -07:00
debuggerd Print the build id of shared libraries if present. 2015-03-17 15:13:35 -07:00
fastboot Add verbose param to sparse_file_import_auto 2015-03-31 12:09:37 -07:00
fs_mgr Merge "Restore verity state when verified partition is reflashed" 2015-04-07 08:45:34 +00:00
gpttool gpttool: turn on -Werror 2014-05-05 10:30:04 -07:00
healthd am 492dd1e5: Merge "Remove obsolete BUILD_TINY_ANDROID check from healthd makefile" 2015-01-24 05:33:56 +00:00
include logd: Don't embed a flexible array member within another struct 2015-04-07 10:12:20 -07:00
init Merge "Set verity mode as the verified property value" 2015-04-07 08:45:24 +00:00
libbacktrace Update the test for better output on error. 2015-04-02 15:36:09 -07:00
libcutils android_filesystem_config: move fs_config to libcutils 2015-04-06 10:04:16 -07:00
libdiskconfig am eb075e28: am c8179498: am 2f62edf7: Merge "libdiskconfig: Turn on -Werror" 2014-05-21 21:19:27 +00:00
libion Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed. 2015-04-02 14:31:07 -07:00
liblog Merge "Share log writing code." 2015-04-03 17:51:13 +00:00
libmemtrack Add missing <malloc.h> and <string.h> includes. 2015-01-28 11:37:57 -08:00
libmincrypt Disable clang optimization that has segmentation fault. 2014-12-17 14:59:53 -08:00
libnativebridge am 0d385d1c: Merge "Track renaming of initUnchangeableSystemProperty." 2015-02-10 16:54:35 +00:00
libnetutils Merge "Improving the time to wait for assigning IP address" 2015-03-19 00:26:30 +00:00
libpixelflinger pixelflinger: make self-contained 2015-03-19 12:34:35 -07:00
libprocessgroup Remove uses of libcxx.mk. 2015-03-27 11:24:04 -07:00
libsparse Add verbose param to sparse_file_import_auto 2015-03-31 12:09:37 -07:00
libsuspend Libsuspend: Remove unused variable 2014-11-24 18:53:44 -08:00
libsync Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed. 2015-04-02 14:31:07 -07:00
libsysutils Add missing <malloc.h> and <string.h> includes. 2015-01-28 11:37:57 -08:00
libusbhost am 0d8943c2: am e4c5b614: Merge "libusbhost: Fix IOCTL call during usb_request_cancel" 2014-08-12 21:05:43 +00:00
libutils Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed. 2015-04-02 14:31:07 -07:00
libziparchive Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed. 2015-04-02 14:31:07 -07:00
lmkd Lmkd: Fix unused variables 2014-11-24 20:32:42 -08:00
logcat Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed. 2015-04-02 14:31:07 -07:00
logd logd: Don't embed a flexible array member within another struct 2015-04-07 10:12:20 -07:00
logwrapper Fix "ptsname is not thread-safe; use ptsname_r instead" build break. 2014-07-29 11:06:53 -07:00
mkbootimg mkbootimg: turn on -Werror 2014-05-05 10:30:04 -07:00
reboot reboot: Turn on -Werror 2014-05-21 12:58:38 -07:00
rootdir Revert "Revert "Adding e4crypt support"" 2015-03-31 13:02:13 -07:00
run-as package missing include for string.h 2015-04-01 11:15:37 -07:00
sdcard Merge "sdcard: Properly handle deleted nodes" 2015-04-04 00:27:46 +00:00
toolbox Lose umount to toybox. 2015-04-02 21:24:34 -07:00
.gitignore Don't compile abort_socket.c for host targets. It is only intended to run on Linux targets. 2009-05-26 13:23:23 -07:00
Android.mk Remove the simulator target from all makefiles. 2011-07-11 22:12:32 -07:00
CleanSpec.mk Add a CleanSpec for grep/toolbox. 2015-03-22 18:04:54 -07:00
MODULE_LICENSE_APACHE2 auto import from //depot/cupcake/@135843 2013-07-30 13:56:49 -07:00
NOTICE Fix omission in NOTICE file. 2013-07-30 13:56:55 -07:00