This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: RFC: X509 parsing fix


I've been looking at this bug:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=174708

This is actually two separate bugs -- an EOF exception in Jessie, and
an X509 parsing bug in Classpath.  I believe the latter buglet was
introduced here:

http://lists.gnu.org/archive/html/classpath-patches/2005-07/msg00156.html

Also while looking at this I noticed that there is similar X509
parsing code in Jessie, and it seems to already have the appended
change in it.

I'd appreciate comments from people who actually understand this code
in depth...

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* gnu/java/security/x509/X509Certificate.java (parse):
	Unconditionally read value; for version==1 case when reading
	algorithm ID.

Index: gnu/java/security/x509/X509Certificate.java
===================================================================
--- gnu/java/security/x509/X509Certificate.java	(revision 109835)
+++ gnu/java/security/x509/X509Certificate.java	(working copy)
@@ -1,5 +1,5 @@
 /* X509Certificate.java -- X.509 certificate.
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -661,10 +661,7 @@
     der.skip(spki.getLength());
     logger.log (Component.X509, "read subjectPublicKey == {0}", subjectKey);
 
-    if (version > 1)
-      {
-        val = der.read();
-      }
+    val = der.read();
     if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 1)
       {
         byte[] b = (byte[]) val.getValue();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]