JDK-8026385 : [macosx] (awt) setjmp/longjmp changes the process signal mask on OS X
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u40
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2013-10-14
  • Updated: 2015-01-21
  • Resolved: 2014-05-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u40Fixed 9 b22Fixed
Related Reports
Relates :  
Relates :  
See JDK-8023786 for a complete description of the problem.

I see several places in the awt and font code that uses setjmp/longjmp which should be changed to use _setjmp/_longjmp on OS X:

$ grep -r longjmp jdk/src
share/native/sun/awt/image/jpeg/imageioJPEG.c:  longjmp(myerr->setjmp_buffer, 1);
share/native/sun/awt/image/jpeg/jpegdecoder.c:  longjmp(myerr->setjmp_buffer, 1);
share/native/sun/awt/libpng/png.h:PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
share/native/sun/awt/libpng/png.h:PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structp png_ptr,
share/native/sun/awt/libpng/png.h:    png_longjmp_ptr longjmp_fn, size_t jmp_buf_size));
share/native/sun/awt/libpng/png.h:      (*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf)))
share/native/sun/awt/libpng/png.h:PNG_EXPORTA(9, void, png_longjmp, (png_structp png_ptr, int val),
share/native/sun/awt/libpng/pngerror.c:   png_longjmp(png_ptr, 1);
share/native/sun/awt/libpng/pngerror.c:png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
share/native/sun/awt/libpng/pngerror.c:         png_ptr->longjmp_fn(tmp_jmpbuf, val);
share/native/sun/awt/libpng/pngerror.c:   png_ptr->longjmp_fn(png_ptr->longjmp_buffer, val);
share/native/sun/awt/splashscreen/splashscreen_jpeg.c:    longjmp(myerr->setjmp_buffer, 1);
solaris/native/sun/awt/gtk2_interface.c:        longjmp(j, NO_SYMBOL_EXCEPTION);
solaris/native/sun/awt/gtk2_interface.c:        longjmp(j, NO_SYMBOL_EXCEPTION);
solaris/native/sun/awt/gtk2_interface.c:            longjmp(j, NO_SYMBOL_EXCEPTION);
added noreg-hard, since this involves signal handlers I don't know of any way to reliably test this with an automated reg test

gtk2_interface should not be compiled on OSX, so no need to fix there

libpng calls png_ptr->longjmp_fn which is set by the client, so it does not need to be modified (it will call PNG_ABORT if the function pointer is not set). The only module that seems to use libpng is splashscreen, so we only need to modify splashscreen_png.c