mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-12-15 17:38:36 +00:00
java: verify against core's version before doing anything
This commit is contained in:
parent
a6d0d7a688
commit
a25a7ad231
@ -275,6 +275,13 @@ public class Capstone {
|
||||
private int detail;
|
||||
|
||||
public Capstone(int arch, int mode) {
|
||||
IntByReference major = new IntByReference();
|
||||
IntByReference minor = new IntByReference();
|
||||
int version = cs.cs_version(major, minor);
|
||||
if (version != (CS_API_MAJOR << 8) + CS_API_MINOR) {
|
||||
throw new RuntimeException("Different API version between core & binding (CS_ERR_VERSION)");
|
||||
}
|
||||
|
||||
this.arch = arch;
|
||||
this.mode = mode;
|
||||
ns = new NativeStruct();
|
||||
|
Loading…
Reference in New Issue
Block a user