diff --git a/CHANGES.md b/CHANGES.md index ef944fcbb..5b4d1ae76 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,7 @@ Features Bug Fixes --------- +* [#1644](https://github.com/java-native-access/jna/issues/1644): Fix bug in VARDESC causing an illegal memory access - [@stmuecke](https://github.com/stmuecke) Release 5.15.0 ============== diff --git a/contrib/platform/src/com/sun/jna/platform/win32/OaIdl.java b/contrib/platform/src/com/sun/jna/platform/win32/OaIdl.java index 2cfd89616..db356f28d 100644 --- a/contrib/platform/src/com/sun/jna/platform/win32/OaIdl.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/OaIdl.java @@ -1398,14 +1398,10 @@ public static class ByReference extends _VARDESC implements public VARIANT.ByReference lpvarValue; public _VARDESC() { - setType("lpvarValue"); - this.read(); } public _VARDESC(Pointer pointer) { super(pointer); - setType("lpvarValue"); - this.read(); } /** @@ -1431,9 +1427,15 @@ public VARDESC() { public VARDESC(Pointer pointer) { super(pointer); - this._vardesc.setType("lpvarValue"); this.read(); } + + @Override + public void read() { + readField("varkind"); + this._vardesc.setType(varkind.value == VARKIND.VAR_CONST ? "lpvarValue" : "oInst"); + super.read(); + } } @FieldOrder({"tdesc", "_elemdesc"})