OSDN Git Service

Do not use StringPiece in ExtractJavaIdentifier
authorPirama Arumuga Nainar <pirama@google.com>
Mon, 24 Sep 2018 22:20:15 +0000 (15:20 -0700)
committerPirama Arumuga Nainar <pirama@google.com>
Tue, 25 Sep 2018 20:21:35 +0000 (13:21 -0700)
commit9ba5cb4796a66b387af1f9350134f742f490aa7f
tree9526df3430e982770a42719f2dc6cc198353950b
parent4a2dd10d834529311bf0daa4d5fa7c81f903bf61
Do not use StringPiece in ExtractJavaIdentifier

Bug: http://b/91353691

After assigning the result of TransformToFieldName to 'result', the
underlying storage is destroyed after the 'if' statement of the function
call.  'result' ends up with garbage if the identifier has a '-'.

ManifestClassGeneratorTest.NormalizePermissionNames is broken for this
reason in 32-bit Windows when using libc++ and 32-bit Linux.  ASAN also
reports this failure for both 32-bit and 64-bit linux.

Test: Run test on the cases mentioned above and ensure all of them pass.
Change-Id: I69163c423c1171b7ac7838f2abe06bdf8058df4c
tools/aapt2/java/ManifestClassGenerator.cpp