[commit] r2768 - trunk/SDK/Java/native/JavaCompRunner
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Wed Nov 14 13:45:50 CST 2018
Author: ksmyth
Date: Wed Nov 14 13:45:50 2018
New Revision: 2768
Log:
Fix buffer overrun when trying to run Java 10 .class with Java 8
Modified:
trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp
Modified: trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp
==============================================================================
--- trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp Wed Nov 14 13:45:48 2018 (r2767)
+++ trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp Wed Nov 14 13:45:50 2018 (r2768)
@@ -270,7 +270,6 @@
COMTHROW(project->CommitTransaction());
}
catch(jthrowable jexc){
- char buf[200];
m_env->ExceptionClear();
try{
jclass throwableClass = m_env->FindClass("java/lang/Throwable");
@@ -289,18 +288,18 @@
if (exc) {
throw exc;
}
-
+
const char *str = m_env->GetStringUTFChars(msg, 0);
- sprintf(buf, "Java exception occurred at component invokation: %s", str);;
+ const char *messageTemplate = "Java exception occurred at component invocation: %s";
+ char* buf = (char*)malloc(strlen(messageTemplate) + strlen(str) + 1);
+ sprintf(buf, messageTemplate, str);
m_env->ReleaseStringUTFChars(msg, str);
-
-
-
-
+
AfxMessageBox(buf);
+ free(buf);
}catch(...){
m_env->ExceptionClear();
- AfxMessageBox("Java exception occurred at component invokation, the cause is unrecoverable.");
+ AfxMessageBox("Java exception occurred at component invocation, the cause is unrecoverable.");
}
if (invokeExStartedATransaction)
More information about the gme-commit
mailing list