RFR: 8241370: Crash in JPEGImageLoader after fix for JDK-8212034
Kevin Rushforth
kcr at openjdk.java.net
Wed Apr 1 13:52:25 UTC 2020
On Wed, 1 Apr 2020 13:39:35 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> This is a regression of [JDK-8212034](https://bugs.openjdk.java.net/browse/JDK-8212034).
>> When image is loaded in WebView usinga url, WebView attempts to load a image frames with partial image data. This was
>> implemented under, JDK-8153148 -> WCImageDecoderImpl.addImageData() -> calls loadFrames() with partial image data.
>>
>> Call to jpeg_read_header() may fail when the partial image data has incomplete header information.
>>
>> In the given case the jpeg_read_header() call fails and code execution flow enters the 'if
>> (setjmp(jerr->setjmp_buffer)) {}' block and results in call to disposeIIO(env, data);, which in turn calls
>> imageio_dispose. This will free cinfo->err and set it to NULL, and the subsequent call to (*cinfo->err->format_message)
>> crashes. Verified All test run, Sanity tests with Ensemble app and Tested different web pages. Added a test, The test
>> passes with fix and causes a native crash without the fix.
>
> tests/system/src/test/java/test/robot/javafx/iio/LoadCorruptJPEGTest.java line 69:
>
>> 68: } catch (FileNotFoundException e) {
>> 69: e.printStackTrace();
>> 70: }
>
> The `FileNotFoundException` should cause the test to fail. Rather than doing a try / catch, I recommend adding `throws
> Exception` to the test method.
Actually, I see that `Util.runAndWait` does not declare `throws Exception`, so you will need to keep the try/catch
here. I recommend to fail the test with `Assert.fail` or `throw new AssertionFailedError(e)`
-------------
PR: https://git.openjdk.java.net/jfx/pull/154
More information about the openjfx-dev
mailing list