Merge "Merge smali upstream into master" am: 9cd7a6e0ac
am: 7fb4020b49

Change-Id: I13955458746a13893b1171afc3ce84743c8e9dc1
diff --git a/baksmali/src/main/java/org/jf/baksmali/Adaptors/Format/InstructionMethodItem.java b/baksmali/src/main/java/org/jf/baksmali/Adaptors/Format/InstructionMethodItem.java
index d58b2b6..b69995d 100644
--- a/baksmali/src/main/java/org/jf/baksmali/Adaptors/Format/InstructionMethodItem.java
+++ b/baksmali/src/main/java/org/jf/baksmali/Adaptors/Format/InstructionMethodItem.java
@@ -501,7 +501,7 @@
                 writer.write("Float.POSITIVE_INFINITY");
             else if (fval == Float.NEGATIVE_INFINITY)
                 writer.write("Float.NEGATIVE_INFINITY");
-            else if (fval == Float.NaN)
+            else if (Float.isNaN(fval))
                 writer.write("Float.NaN");
             else if (fval == Float.MAX_VALUE)
                 writer.write("Float.MAX_VALUE");
@@ -528,7 +528,7 @@
                 writer.write("Double.POSITIVE_INFINITY");
             else if (dval == Double.NEGATIVE_INFINITY)
                 writer.write("Double.NEGATIVE_INFINITY");
-            else if (dval == Double.NaN)
+            else if (Double.isNaN(dval))
                 writer.write("Double.NaN");
             else if (dval == Double.MAX_VALUE)
                 writer.write("Double.MAX_VALUE");
diff --git a/build.gradle b/build.gradle
index 08da9c8..360e3db 100644
--- a/build.gradle
+++ b/build.gradle
@@ -31,7 +31,7 @@
 
 apply plugin: 'idea'
 
-version = '2.2.1'
+version = '2.2.2'
 def jcommanderVersion = ''
 
 if (!('release' in gradle.startParameter.taskNames)) {
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/raw/DebugInfoItem.java b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/raw/DebugInfoItem.java
index 1ddd4ac..32ee4cc 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/raw/DebugInfoItem.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/raw/DebugInfoItem.java
@@ -52,8 +52,8 @@
             public void annotateItem(@Nonnull AnnotatedBytes out, int itemIndex, @Nullable String itemIdentity) {
                 DexReader reader = dexFile.readerAt(out.getCursor());
 
-                int lineStart = reader.readSmallUleb128();
-                out.annotateTo(reader.getOffset(), "line_start = %d", lineStart);
+                int lineStart = reader.readBigUleb128();
+                out.annotateTo(reader.getOffset(), "line_start = %d", lineStart & 0xFFFFFFFFL);
 
                 int parametersSize = reader.readSmallUleb128();
                 out.annotateTo(reader.getOffset(), "parameters_size = %d", parametersSize);
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/writer/DexDataWriter.java b/dexlib2/src/main/java/org/jf/dexlib2/writer/DexDataWriter.java
index 0102b75..f33a3be 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/writer/DexDataWriter.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/writer/DexDataWriter.java
@@ -127,7 +127,7 @@
     }
 
     public static void writeUleb128(OutputStream out, int value) throws IOException {
-        while (value > 0x7f) {
+        while ((value & 0xffffffffL) > 0x7f) {
             out.write((value & 0x7f) | 0x80);
             value >>>= 7;
         }