Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicornStructure类型定义BUG #85

Open
chago opened this issue Feb 11, 2020 · 2 comments
Open

UnicornStructure类型定义BUG #85

chago opened this issue Feb 11, 2020 · 2 comments

Comments

@chago
Copy link

chago commented Feb 11, 2020

问题:但凡字段中存在long或者64位长度的Pointer字段,这个64位字段前面的字段会自动扩充成64位

例子:
环境:
iOS 64 Emulator

结构
`
public class MachPortsLookupReply extends UnicornStructure {

public MachPortsLookupReply(Pointer p) {
    super(p);
}

public int retCode;
public Pointer outPort;
public int ret;
public int mask;
public int reserved1;
public int reserved2;
public int cnt;

@Override
protected List<String> getFieldOrder() {
    return Arrays.asList("retCode", "outPort", "ret", "mask", "reserved1", "reserved2", "cnt");
}

}

`
操作:

MachPortsLookupReply test = new MachPortsLookupReply(statbuf);
test.unpack();
dumpMemory(statbuf,test.size());
test.retCode = 1;
test.outPort = UnicornPointer.pointer(emulator, 0x1f1f1f1f1l);
test.pack();
dumpMemory(statbuf,test.size());

赋值前输出:

-----------------------------------------------------------------------------<
[13:05:12 760]dump:, md5=52cbdba6198d3038782fcf0d6306e515, hex=c8e2ffbf0f00000060513e00010000000100000000000000c04f3e0001000000b0e2ffbf0f000000
size: 40
0000: C8 E2 FF BF 0F 00 00 00 60 51 3E 00 01 00 00 00 ........`Q>.....
0010: 01 00 00 00 00 00 00 00 C0 4F 3E 00 01 00 00 00 .........O>.....
0020: B0 E2 FF BF 0F 00 00 00 ........
^-----------------------------------------------------------------------------^

赋值后输出:

-----------------------------------------------------------------------------<
[13:05:12 760]dump:, md5=959a3b301b86e43498abeeef38cba01b, hex=010000000f000000f1f1f1f1010000000100000000000000c04f3e0001000000b0e2ffbf0f000000
size: 40
0000: 01 00 00 00 0F 00 00 00 F1 F1 F1 F1 01 00 00 00 ................
0010: 01 00 00 00 00 00 00 00 C0 4F 3E 00 01 00 00 00 .........O>.....
0020: B0 E2 FF BF 0F 00 00 00 ........
^-----------------------------------------------------------------------------^

这个retCode字段本来只有32位,现在变成了64位

@zhkl0228
Copy link
Owner

好的,在新版中修复

@zhkl0228
Copy link
Owner

已经更新了,上次提到的问题也已经修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants