OSDN Git Service

Fix bug in APK entry alignment.
authorAlex Klyubin <klyubin@google.com>
Wed, 23 Mar 2016 20:05:27 +0000 (13:05 -0700)
committerAlex Klyubin <klyubin@google.com>
Thu, 24 Mar 2016 01:11:35 +0000 (18:11 -0700)
commit284e45ac09cb9b58a4bf3274fb28398074a3bd1b
tree961c1c3b6031f3dd9e85bdb31d7b02def6525725
parent901590ae2aea651be1f5cc972674a3ba8d8ee430
Fix bug in APK entry alignment.

APK entry alignment logic assumes that input entries have zero-length
comment and extra fields. When the assumption is broken, the logic
silently breaks alignment of output entries. This happens, for
example, when the APK to be signed is already aligned and thus may
contain entries with non-empty extra fields.

Given that APKs are not supposed to use comment and extra fields for
anything useful and given that this signer already discards comment
and extra fields of compressed entries, this change makes the signer
discard comment and extra fields of STORED input entries as well.
This unbreaks the existing alignment logic.

Bug: 27814973

(cherry picked from commit 37a0ecd32935685151f0cfb5a5466e6e360a0b8f)

Change-Id: If2e0df6d3298e9736ef175bb0d9a05d450164c9f
tools/signapk/src/com/android/signapk/SignApk.java