diff options
author | Johan Redestig <johan.redestig@sonymobile.com> | 2016-08-10 14:57:27 +0200 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2017-02-23 14:46:05 -0800 |
commit | 22723ffabaf37a23c39870f4ffc4794c76b3a755 (patch) | |
tree | 47bf82094cb720199e9e75de39a178858eb19b43 /tools/aapt2/diff/Diff.cpp | |
parent | 8716ef94194ad715ef596de4a38abb5b2a5c8186 (diff) |
Fix mStringBlocks race in the AssetManager
There were a few places where access to the mStringBlocks were
not protected.
The crashes seen where similar to:
java.lang.NullPointerException: Attempt to invoke virtual method \
'java.lang.CharSequence android.content.res.StringBlock.get(int)' on a null object reference
at android.content.res.AssetManager.getResourceValue(AssetManager.java:222)
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:188)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2110)
at android.content.res.Resources.getLayout(Resources.java:1111)
java.lang.NullPointerException: Attempt to invoke virtual method \
'java.lang.CharSequence android.content.res.StringBlock.get(int)' on a null object reference
at android.content.res.AssetManager.getPooledStringForCookie(AssetManager.java:312)
at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:1212)
at android.content.res.TypedArray.getValueAt(TypedArray.java:1198)
at android.content.res.TypedArray.getColor(TypedArray.java:446)
What happened was that thread 1 was creating a new mStringBlocks in
makeStringBlocks while thread 2 was accessing mStringBlocks. The
makeStringBlocks starts off by overwriting mStringBlocks with a new
empty array and when thread 2 accessed its content NPE happened.
Bug: 30802713
Test: None (just added synchronization to help prevent races)
Change-Id: I810da26b161a6528b0dd241048dde5b239089244
Diffstat (limited to 'tools/aapt2/diff/Diff.cpp')
0 files changed, 0 insertions, 0 deletions