summaryrefslogtreecommitdiffstats
path: root/dx
diff options
context:
space:
mode:
authorjwilson <jwilson@squareup.com>2012-12-17 13:16:33 -0500
committerjwilson <jwilson@squareup.com>2012-12-17 13:16:33 -0500
commit0a752f071fbbdfeab5dd9a230efe0f4f47b8cd94 (patch)
tree72e27b1ab5007d361c05b3ca69835fad6f178467 /dx
parent48b9590264d6f7ca683385c6fac6d98e6d9735fb (diff)
downloadandroid_dalvik-0a752f071fbbdfeab5dd9a230efe0f4f47b8cd94.tar.gz
android_dalvik-0a752f071fbbdfeab5dd9a230efe0f4f47b8cd94.tar.bz2
android_dalvik-0a752f071fbbdfeab5dd9a230efe0f4f47b8cd94.zip
Fail if the new index is out of range.
We were silently truncating, which made an obvious problem into a non-obvious one. Bug: http://code.google.com/p/android/issues/detail?id=40409 Change-Id: I15576357c72ac0e98cf85c0a1d289fd5009468f9
Diffstat (limited to 'dx')
-rw-r--r--dx/src/com/android/dx/merge/DexMerger.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/dx/src/com/android/dx/merge/DexMerger.java b/dx/src/com/android/dx/merge/DexMerger.java
index fc4d14513..b7677cf88 100644
--- a/dx/src/com/android/dx/merge/DexMerger.java
+++ b/dx/src/com/android/dx/merge/DexMerger.java
@@ -406,6 +406,9 @@ public final class DexMerger {
}
@Override void updateIndex(int offset, IndexMap indexMap, int oldIndex, int newIndex) {
+ if (newIndex < 0 || newIndex > 0xffff) {
+ throw new IllegalArgumentException("type ID not in [0, 0xffff]: " + newIndex);
+ }
indexMap.typeIds[oldIndex] = (short) newIndex;
}
@@ -446,6 +449,9 @@ public final class DexMerger {
}
@Override void updateIndex(int offset, IndexMap indexMap, int oldIndex, int newIndex) {
+ if (newIndex < 0 || newIndex > 0xffff) {
+ throw new IllegalArgumentException("proto ID not in [0, 0xffff]: " + newIndex);
+ }
indexMap.protoIds[oldIndex] = (short) newIndex;
}
@@ -466,6 +472,9 @@ public final class DexMerger {
}
@Override void updateIndex(int offset, IndexMap indexMap, int oldIndex, int newIndex) {
+ if (newIndex < 0 || newIndex > 0xffff) {
+ throw new IllegalArgumentException("field ID not in [0, 0xffff]: " + newIndex);
+ }
indexMap.fieldIds[oldIndex] = (short) newIndex;
}
@@ -486,6 +495,9 @@ public final class DexMerger {
}
@Override void updateIndex(int offset, IndexMap indexMap, int oldIndex, int newIndex) {
+ if (newIndex < 0 || newIndex > 0xffff) {
+ throw new IllegalArgumentException("method ID not in [0, 0xffff]: " + newIndex);
+ }
indexMap.methodIds[oldIndex] = (short) newIndex;
}