OSDN Git Service

simpleperf: fix potential unaligned memory access.
authorYabin Cui <yabinc@google.com>
Mon, 14 Nov 2016 19:23:14 +0000 (11:23 -0800)
committerYabin Cui <yabinc@google.com>
Mon, 14 Nov 2016 19:23:14 +0000 (11:23 -0800)
commitf79a00874d415ba7e7fda01cf2eb76bf06e459a6
treea87631f54174b503b5c4eb79e34de4a4cccbaf69
parentee71d0b6a8e00630d4af34d5be7acb2369855e33
simpleperf: fix potential unaligned memory access.

1. It is reported that when elf section headers are malformed,
GetBuildIdFromNoteSection() aborts with SIGBUS. So fix it to
accept not 4 bytes aligned section data.
2. Fix potential unaligned memory access in ConvertBytesToValue().

Test: run simpleperf_unit_test.
Change-Id: I2e1612a6567978e0b526b2274377765ba2837ec2
simpleperf/read_elf.cpp
simpleperf/read_elf.h
simpleperf/read_elf_test.cpp
simpleperf/utils.cpp
simpleperf/utils_test.cpp