tada / pljava

PL/Java is a free add-on module that brings Java™ Stored Procedures, Triggers, Functions, Aggregates, Operators, Types, etc., to the PostgreSQL™ backend.
http://tada.github.io/pljava/
Other
238 stars 77 forks source link

Avoid crash on exception in String initialization #446

Closed jcflack closed 1 year ago

jcflack commented 1 year ago

Addresses #416, an unlikely scenario that combined a database set for SQL_ASCII with an unworkable setting in pljava.vmoptions, where the combination caused an UnsupportedCharsetException during initialization in String.c, and elogExceptionMessage tried to use the incompletely-initialized String routines, causing a crash.

Effort had been put in String.c to avoid such outcomes, by having initial values of uninitialized and s_two_step_conversion that provide a fallback capability before initialization is complete. However, the initial value of s_two_step_conversion could be changed to its runtime-determined value too early, with some other initialization steps yet to be done.