RFR: 8315074: Possible null pointer access in native glass

Kevin Rushforth kcr at openjdk.org
Mon Aug 28 21:30:24 UTC 2023


On Mon, 28 Aug 2023 20:30:18 GMT, Johan Vos <jvos at openjdk.org> wrote:

>> At multiple places in native glass code we don't have appropriate NULL checks which might result in null pointer access.
>> 
>> Added appropriate checks and all test run is green.
>
> modules/javafx.graphics/src/main/native-glass/gtk/GlassApplication.cpp line 270:
> 
>> 268:         // we release this context in call_runnable
>> 269:     } else {
>> 270:         fprintf(stderr, "malloc failed in GtkApplication__1submitForLaterInvocatio\n");
> 
> if the malloc above failed, I would think there might be very serious errors hence maybe this should be propagated to the Java layer, or throw the relevant memory exception?

That's a good question. Since this is a void method (thus there is no way to signal an error), the ideal thing would be to throw an `OutOfMemoryError` before returning, but if a malloc of this small size were to fail, we might not even be able to create the OOME. Not sure it's worth it in this case. What do you think?

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

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


More information about the openjfx-dev mailing list