OSDN Git Service

crash if getNativeBuffer() called on NULL GraphicBuffer
authorColin Cross <ccross@android.com>
Tue, 22 Jul 2014 22:55:08 +0000 (15:55 -0700)
committerThe Android Automerger <android-build@google.com>
Wed, 23 Jul 2014 21:47:55 +0000 (14:47 -0700)
commitb2aada6e8481575304f50594d715b8eeac1b54be
tree60cd1379e2a52764d85a678dbc5b4268586f33eb
parent9b365296a745751c08731f369435e00682165f18
crash if getNativeBuffer() called on NULL GraphicBuffer

If getNativeBuffer() is called on a NULL GraphicBuffer the
static_cast of this from GraphicBuffer* to ANativeWindowBuffer*
will return a small pointer like (ANativeWindowBuffer*)0x10.
This value can propagate past NULL checks until it causes a crash
far away from the original NULL pointer.  Crash immediately
instead.

Change-Id: Id614b9eb1484108b3c3c733545309844c4b87532
libs/ui/GraphicBuffer.cpp