changeset in /hg/icedtea: Fix a mistake in previous commit re: i...

Deepak Bhole dbhole at redhat.com
Thu Dec 4 06:11:22 PST 2008


changeset 9aae858397f9 in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=9aae858397f9
description:
	Fix a mistake in previous commit re: integer overflow.

diffstat:

2 files changed, 14 insertions(+), 2 deletions(-)
ChangeLog        |    4 ++++
IcedTeaPlugin.cc |   12 ++++++++++--

diffs (68 lines):

diff -r b8307e2d80a5 -r 9aae858397f9 ChangeLog
--- a/ChangeLog	Fri Nov 21 22:48:56 2008 +0100
+++ b/ChangeLog	Fri Nov 21 18:35:27 2008 -0500
@@ -1,3 +1,7 @@ 2008-11-21  Mark Wielaard  <mark at klomp.o
+2008-11-21  Deepak Bhole  <dbhole at redhat.com>
+
+	* IcedTeaPlugin.cc: Fix a mistake in previous commit re: integer overflow.
+
 2008-11-21  Mark Wielaard  <mark at klomp.org>
 
 	* patches/icedtea-stroker-finish.patch: New patch.
diff -r b8307e2d80a5 -r 9aae858397f9 IcedTeaPlugin.cc
--- a/IcedTeaPlugin.cc	Fri Nov 21 22:48:56 2008 +0100
+++ b/IcedTeaPlugin.cc	Fri Nov 21 18:35:27 2008 -0500
@@ -4638,6 +4638,7 @@ IcedTeaJNIEnv::ValueString (jni_type typ
   PLUGIN_TRACE_JNIENV ();
   nsCString retstr ("");
 
+  char* longVal = (char*) malloc(sizeof(char)*20);
   switch (type)
     {
     case jboolean_type:
@@ -4656,7 +4657,8 @@ IcedTeaJNIEnv::ValueString (jni_type typ
       retstr.AppendInt (value.i);
       break;
     case jlong_type:
-      retstr += IcedTeaPrintfCString ("%ld", value.j);
+      sprintf(longVal, "%"PRId64, value.j);
+      retstr += longVal;
       break;
     case jfloat_type:
       retstr += IcedTeaPrintfCString ("%f", value.f);
@@ -4672,6 +4674,8 @@ IcedTeaJNIEnv::ValueString (jni_type typ
     default:
       break;
     }
+
+  free(longVal);
 
   // Freed by calling function.
   return strdup (retstr.get ());
@@ -4762,6 +4766,7 @@ IcedTeaJNIEnv::ExpandArgs (JNIID* id, jv
   // Method.
   int arg = 0;
   char* fl;
+  char* longVal = (char*) malloc(sizeof(char)*20);
   while (id->signature[i] != stopchar)
     {
       switch (id->signature[i])
@@ -4785,7 +4790,8 @@ IcedTeaJNIEnv::ExpandArgs (JNIID* id, jv
           retstr.AppendInt (args[arg].i);
           break;
         case 'J':
-          retstr += IcedTeaPrintfCString ("%ld", args[arg].j);
+          sprintf(longVal, "%"PRId64, args[arg].j);
+          retstr += longVal;
           break;
         case 'F':
           retstr += IcedTeaPrintfCString ("%f", args[arg].f);
@@ -4833,6 +4839,8 @@ IcedTeaJNIEnv::ExpandArgs (JNIID* id, jv
 	  arg++;
     }
 
+  free(longVal);
+
   // Freed by calling function.
   return strdup (retstr.get ());
 }



More information about the distro-pkg-dev mailing list