OSDN Git Service

Ensure all fields of AutoBufferPointer are initialized
authorOrion Hodson <oth@google.com>
Mon, 15 Apr 2019 15:14:51 +0000 (16:14 +0100)
committerOrion Hodson <oth@google.com>
Mon, 15 Apr 2019 15:38:56 +0000 (16:38 +0100)
commite522c99430ec9ee0b4daa588dbcaea4824bc3f70
tree69f66decfcf44909afc09e38dfd4a5cf5afd1138
parentf013e9b2e852520b78ca7781a864de0ab96ded12
Ensure all fields of AutoBufferPointer are initialized

In the process of revising libnativehelper interface, the
initialization of the fArray field was dropped. This change fixes
this and adds regression tests.

In writing the tests, it became apparent that the AutoBufferPointer
destructor would crash if the underlying buffer was heap array backed
and the buffer position was non-zero. ReleasePrimitiveArrayCritical
was called with the element corresponding to the current position
rather than the first element.

Bug: b/130390512
Test: atest FrameworksCoreTests:android.graphics.BitmapTest
Change-Id: I319512aaede7ba8af5d013c9281417695abf9099
core/jni/android_nio_utils.cpp
core/jni/android_nio_utils.h
core/tests/coretests/src/android/graphics/BitmapTest.java