On Thu, 21 Nov 2024 21:26:01 GMT, Adam Bruce <d...@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 > > Adam Bruce has updated the pull request incrementally with one additional > commit since the last revision: > > Move static check to sharedGetFieldValues, add JDWP tests src/jdk.jdwp.agent/share/native/libjdwp/util.c line 516: > 514: > 515: if (!isStatic) { > 516: clazz = JNI_FUNC_PTR(env,GetObjectClass)(env, object); You need to free the jobject before exiting this function. Note you only do this if clazz is allocated here. The assignment to clazz above is from a jobject that the debug agent is managing (as part of mapping JDWP ObjectIDs to jobjects), so it should not be freed for the static case. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22280#discussion_r1857397453