summaryrefslogtreecommitdiffstats
path: root/dx
diff options
context:
space:
mode:
authorJesse Wilson <jwilson@squareup.com>2012-09-01 01:01:05 -0400
committerJesse Wilson <jwilson@squareup.com>2012-09-01 01:01:05 -0400
commitbf7dfeea94f21dd0e097cf5f786f9995722fd70d (patch)
tree732772fe1b5cd965ebce5c6870dc044ae6e00244 /dx
parent3e46814d8984243612176c9b15d8d012dcca2143 (diff)
downloadandroid_dalvik-bf7dfeea94f21dd0e097cf5f786f9995722fd70d.tar.gz
android_dalvik-bf7dfeea94f21dd0e097cf5f786f9995722fd70d.tar.bz2
android_dalvik-bf7dfeea94f21dd0e097cf5f786f9995722fd70d.zip
Fix a bug where the max blowup of annotations was incorrect.
I'm not sure where the 1.34 number comes from but it's incorrect. From the spec, the encoded_annotation is made up of a single byte plus an unlimited number of uleb128 values. Each of these values can double in width in the worst case. I received (personal) email from one user who'd run into a case worse than the incorrect 1.34 limit. Change-Id: I3b676e6d2b274aaa538ca61ce23945b3d49aff04
Diffstat (limited to 'dx')
-rw-r--r--dx/src/com/android/dx/merge/DexMerger.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/dx/src/com/android/dx/merge/DexMerger.java b/dx/src/com/android/dx/merge/DexMerger.java
index c48f436f4..8237bda65 100644
--- a/dx/src/com/android/dx/merge/DexMerger.java
+++ b/dx/src/com/android/dx/merge/DexMerger.java
@@ -1011,8 +1011,8 @@ public final class DexMerger {
classData += (int) Math.ceil(contents.classDatas.byteCount * 1.34);
// all of the bytes in an encoding arrays section may be uleb/sleb
encodedArray += contents.encodedArrays.byteCount * 2;
- // at most 1/3 of the bytes in an encoding arrays section are uleb/sleb
- annotation += (int) Math.ceil(contents.annotations.byteCount * 1.34);
+ // all of the bytes in an annotations section may be uleb/sleb
+ annotation += (int) Math.ceil(contents.annotations.byteCount * 2);
// all of the bytes in a debug info section may be uleb/sleb
debugInfo += contents.debugInfos.byteCount * 2;
}