RFR: 6726901: JDWP: ReferenceType.GetValues crashes jvm in case non-static fields are passed

Chris Plummer cjplummer at openjdk.org
Thu Nov 21 03:04:15 UTC 2024


On Wed, 20 Nov 2024 18:09:08 GMT, Adam Bruce <duke at openjdk.org> wrote:

> This PR fixes a long-standing bug in JDWP where the access flags of a field are not checked before attempting to read it's value. 
> 
> Prior to this change, attempting to read a non-static field would cause a JVM crash, this change corrects that behaviour by returning `INVALID_FIELDID` instead.
> 
> This is my first PR to OpenJDK, so please let me know if I've made any mistakes in the process.
> 
> Cheers,
> Adam

The following two tests would be good starting points for writing new test cases. You can clone them and then modify them to expect errors due to static mismatch.

test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/GetValues/getvalues001.java
test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/GetValues/getvalues001.java

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22280#issuecomment-2489967303


More information about the serviceability-dev mailing list