In Exceptions::fthrow we have:
void Exceptions::fthrow(JavaThread* thread, const char* file, int line, Symbol* h_name, const char* format, ...) {
const int max_msg_size = 1024;
va_list ap;
va_start(ap, format);
char msg[max_msg_size];
os::vsnprintf(msg, max_msg_size, format, ap);
va_end(ap);
_throw_msg(thread, file, line, h_name, msg);
}
The incoming format string and any subsequent char* args are expected to be valid UTF8 sequences. The expanded string will be converted back to UTF16 to become the java.lang.String that holds the detail message of the exception. But we pass vsnprintf a buffer of 1024 which means the expanded string may be truncated, but we have no guarantee it will be truncated such that it is still a valid UTF8 sequence - we may end on a partial multi-byte character.
void Exceptions::fthrow(JavaThread* thread, const char* file, int line, Symbol* h_name, const char* format, ...) {
const int max_msg_size = 1024;
va_list ap;
va_start(ap, format);
char msg[max_msg_size];
os::vsnprintf(msg, max_msg_size, format, ap);
va_end(ap);
_throw_msg(thread, file, line, h_name, msg);
}
The incoming format string and any subsequent char* args are expected to be valid UTF8 sequences. The expanded string will be converted back to UTF16 to become the java.lang.String that holds the detail message of the exception. But we pass vsnprintf a buffer of 1024 which means the expanded string may be truncated, but we have no guarantee it will be truncated such that it is still a valid UTF8 sequence - we may end on a partial multi-byte character.
- links to
-
Commit(master) openjdk/jdk/5b7bb40d
-
Review(master) openjdk/jdk/20345