Bug#828836: libmysql-java: ClassNotFound exception IF running in a v8 JVM

Fritz Elfert fritz at fritz-elfert.de
Tue Jun 28 10:15:33 UTC 2016


Package: libmysql-java
Version: 5.1.39-1~deb7u1
Severity: important
Tags: patch

Dear Maintainer,

The latest backport of libmysql-java in [security] crashes with a
ClassNotFound exception, *IF* running under a v8 virtual machine.
(I'm using a wheezy backport of OpenJDK-8 which is available here:
http://download.opensuse.org/repositories/home:/ods/Debian_7.0/ )

I investigated the source package and found the reason:

In several locations of the generic code, there is code like
this (pseudo-code follows):

if (Util.isJdbc42()) {
  ... invoke JDBC42 classes
} else {
  ... use older implementation specifics
}

The method Util.isJdbc4() returns true, if running under a v8 JVM.
In order to *COMPLETELY* disable invocation of JDBC42 specific code, the
method Util.isJdbc4() should *ALWAYS* return false.

The following patch fixes that:
=============================== SNIP =================================
--- a/src/com/mysql/jdbc/Util.java	2016-06-28 11:05:51.065799452 +0200
+++ b/src/com/mysql/jdbc/Util.java	2016-06-28 11:07:34.545802936 +0200
@@ -62,7 +62,7 @@
 
     private static boolean isJdbc4;
 
-    private static boolean isJdbc42;
+    private static boolean isJdbc42 = false;
 
     private static int jvmVersion = -1;
 
@@ -76,13 +76,6 @@
             isJdbc4 = false;
         }
 
-        try {
-            Class.forName("java.sql.JDBCType");
-            isJdbc42 = true;
-        } catch (Throwable t) {
-            isJdbc42 = false;
-        }
-
         String jvmVersionString = System.getProperty("java.version");
         int startPos = jvmVersionString.indexOf('.');
         int endPos = startPos + 1;
=============================== SNIP =================================

Cheers
 -Fritz

-- System Information:
Debian Release: 7.10
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: disable-JDBC42-invocation.patch
Type: text/x-diff
Size: 725 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-java-maintainers/attachments/20160628/67cff500/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: disable-JDBC42-invocation.patch
Type: text/x-diff
Size: 725 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-java-maintainers/attachments/20160628/67cff500/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: disable-JDBC42-invocation.patch
Type: text/x-diff
Size: 726 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-java-maintainers/attachments/20160628/67cff500/attachment-0002.patch>


More information about the pkg-java-maintainers mailing list