RFR: 8315074: Possible null pointer access in native glass [v2]

Kevin Rushforth kcr at openjdk.org
Mon Sep 11 15:25:46 UTC 2023


On Tue, 29 Aug 2023 13:54:19 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> I'm not against that, especially since it's in line with what we do in other functions in glass.
>> However, I am worried about the consequences. In case we just return, the caller has no idea that there is a major problem. A Runnable is supplied to e.g. _invokeAndWait, but it will never get executed while the caller (and the application logic) assumes it is scheduled. This can have serious consequences and unexpected behavior in the application.
>> But maybe I'm missing something and it is less severe than I'm picturing it?
>
> I can see what you are saying, but worth noting in this specific case is that if the malloc of `RunnableContext` (a 12-byte struct) fails, we're not going to be able to allocate an OOME anyway.
> 
> My preference would be to leave this fix as is, and file a follow-up issue to change the return type of `GtkApplication::submitForLaterInvocation` (and the equivalent methods in the other glass pipelines) to `boolean` so we can return an error code and throw an exception (which would very likely provoke an OOME, but in any case would never silently fail).

I filed the following two follow-on umbrella tasks:

[JDK-8316020](https://bugs.openjdk.org/browse/JDK-8316020): ☂ Check memory allocation for null return value (P3)
[JDK-8316022](https://bugs.openjdk.org/browse/JDK-8316022): ☂ Memory allocation failure should throw OOME (P4)

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1223#discussion_r1321718226


More information about the openjfx-dev mailing list