ensure the string index is <= 0xFFFF before writing a string-const instruction

git-svn-id: https://smali.googlecode.com/svn/trunk@504 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-12-23 05:27:14 +00:00
parent d6a7a212e0
commit f6c7706102

View File

@ -69,6 +69,10 @@ public class Instruction21c extends InstructionWithReference implements SingleRe
}
protected void writeInstruction(AnnotatedOutput out, int currentCodeOffset) {
if(opcode == Opcode.CONST_STRING && getReferencedItem().getIndex() > 0xFFFF) {
throw new RuntimeException("String offset is too large for const-string. Use string-const/jumbo instead.");
}
out.writeByte(opcode.value);
out.writeByte(regA);
out.writeShort(getReferencedItem().getIndex());