mirror of
https://github.com/revanced/smali.git
synced 2025-06-13 04:27:38 +02:00
Fixed an issue with the handling of large line numbers (larger than a signed short)
git-svn-id: https://smali.googlecode.com/svn/trunk@231 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
@ -228,17 +228,18 @@ public final class ByteArrayAnnotatedOutput
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int writeUnsignedLeb128(int value) {
|
||||
int remaining = value >> 7;
|
||||
long remaining = (value & 0xFFFFFFFFL) >> 7;
|
||||
long lValue = value;
|
||||
int count = 0;
|
||||
|
||||
while (remaining != 0) {
|
||||
writeByte((value & 0x7f) | 0x80);
|
||||
value = remaining;
|
||||
writeByte((int)(lValue & 0x7f) | 0x80);
|
||||
lValue = remaining;
|
||||
remaining >>= 7;
|
||||
count++;
|
||||
}
|
||||
|
||||
writeByte(value & 0x7f);
|
||||
writeByte((int)(lValue & 0x7f));
|
||||
return count + 1;
|
||||
}
|
||||
|
||||
|
@ -221,6 +221,7 @@ public class DebugInfoBuilder
|
||||
addressDelta = 0;
|
||||
}
|
||||
|
||||
//TODO: need to handle the case when the line delta is larger than a signed int
|
||||
debugInstructions.add(new SpecialOpcode(calculateSpecialOpcode(lineDelta, addressDelta)));
|
||||
|
||||
|
||||
|
@ -36,13 +36,13 @@ public final class Leb128Utils {
|
||||
*/
|
||||
public static int unsignedLeb128Size(int value) {
|
||||
// TODO: This could be much cleverer.
|
||||
long lValue = value & 0xFFFFFFFFL;
|
||||
|
||||
int remaining = value >> 7;
|
||||
long remaining = lValue >> 7L;
|
||||
int count = 0;
|
||||
|
||||
while (remaining != 0) {
|
||||
value = remaining;
|
||||
remaining >>= 7;
|
||||
while (remaining != 0L) {
|
||||
remaining >>= 7L;
|
||||
count++;
|
||||
}
|
||||
|
||||
|
@ -1239,9 +1239,9 @@ integral_literal returns[int value]
|
||||
: long_literal
|
||||
{
|
||||
literalTools.checkInt($long_literal.value);
|
||||
$value = (short)$long_literal.value;
|
||||
$value = (int)$long_literal.value;
|
||||
}
|
||||
| integer_literal {$value = (short)$integer_literal.value;}
|
||||
| integer_literal {$value = $integer_literal.value;}
|
||||
| short_literal {$value = $short_literal.value;}
|
||||
| byte_literal {$value = $byte_literal.value;};
|
||||
|
||||
|
Reference in New Issue
Block a user