OSDN Git Service

DO NOT MERGE opengl: Fix QemuPipeStream::readFully reading beyond end of buffer
authorYu Ning <yu.ning@intel.com>
Thu, 16 Jul 2015 06:54:04 +0000 (14:54 +0800)
committerKonstantinos Menychtas <kmenychtas@google.com>
Tue, 21 Jul 2015 16:53:37 +0000 (16:53 +0000)
commite40e60a6ad91ac2c42837d1a9cb84037cc2a6e5f
treeda9ad08e75ec2a5fb022c14811bcbceb37fc256a
parent9f87f57d58278b3837d44d96884dc63cbee501ad
DO NOT MERGE opengl: Fix QemuPipeStream::readFully reading beyond end of buffer

When GPU emulation is enabled, the emulator sometimes freezes, with an
error message in logcat similar to the following:

 QemuPipeStream::readFully failed (buf 0x7f9cd8ab8000): Bad address

Some users have reported the same issue, e.g.:

 https://code.google.com/p/android/issues/detail?id=170633

The root cause is that QemuPipeStream::readFully(void *buf, size_t len)
may attempt to read beyond (buf + len), resulting in a -EFAULT return
value from the goldfish/qemu pipe driver.

Fix this bug to improve the stability of the emulator. In addition,

 - Add more information to the said error message to facilitate future
   debugging.
 - Use "%zu" instead of "%d" for logging size_t variables.

Change-Id: I8785fee0427fd6c0f25237470b346e769a82c992
Signed-off-by: Yu Ning <yu.ning@intel.com>
Signed-off-by: Pengcheng Chen <pengcheng.chen@intel.com>
opengl/system/OpenglSystemCommon/QemuPipeStream.cpp