Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 1447663 Details for
Bug 1577991
org.mozilla.jss.netscape.security.util.ObjectIdentifier cannot parse OID arcs larger than Integer.MAX_VALUE
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Revised patch with BigInteger support.
1577991.patch (text/plain), 7.60 KB, created by
Jack Magne
on 2018-06-05 01:31:14 UTC
(
hide
)
Description:
Revised patch with BigInteger support.
Filename:
MIME Type:
Creator:
Jack Magne
Created:
2018-06-05 01:31:14 UTC
Size:
7.60 KB
patch
obsolete
>21a22 >> import java.math.BigInteger; >67c68 >< components = new int[componentLen]; >--- >> components = new BigInteger[componentLen]; >74c75 >< components[i++] = Integer.valueOf(comp).intValue(); >--- >> components[i++] = new BigInteger(comp); >78c79 >< components[i] = Integer.valueOf(comp).intValue(); >--- >> components[i] = new BigInteger(comp); >87d87 >< components = values.clone(); >88a89,95 >> BigInteger[] tmp = new BigInteger[componentLen]; >> >> for (int i = 0; i < componentLen; i++) { >> tmp[i] = BigInteger.valueOf(values[i]); >> } >> >> components = tmp.clone(); >93a101,138 >> public ObjectIdentifier(BigInteger values[]) { >> try { >> componentLen = values.length; >> >> componentLen = values.length; >> BigInteger[] tmp = new BigInteger[componentLen]; >> >> for (int i = 0; i < componentLen; i++) { >> tmp[i] = new BigInteger(values[i].toString()); >> } >> >> components = tmp.clone(); >> >> } catch(Throwable t) { >> System.out.println("X509.ObjectIdentifier(), no cloning!"); >> } >> } >> >> /** >> * Constructs an object ID from an array of longs This >> * is used to construct constant object IDs. >> */ >> public ObjectIdentifier(long values[]) { >> try { >> componentLen = values.length; >> BigInteger[] tmp = new BigInteger[componentLen]; >> >> for (int i = 0; i < componentLen; i++) { >> tmp[i] = BigInteger.valueOf(values[i]); >> } >> >> components = tmp.clone(); >> } catch (Throwable t) { >> System.out.println("X509.ObjectIdentifier(), no cloning!"); >> } >> } >> >> >141a187,188 >> >> >153c200 >< int component; >--- >> BigInteger component; >156,157c203,204 >< for (components = new int[allocationQuantum], componentLen = 0; in.available() > bufferEnd;) { >< component = getComponent(in); >--- >> for (components = new BigInteger[allocationQuantum], componentLen = 0; in.available() > bufferEnd;) { >> component = getComponentBigInt(in); >160c207 >< int X, Y; >--- >> long X, Y; >171c218 >< if (component < 40) >--- >> if (component.intValue() < 40) >173c220 >< else if (component < 80) >--- >> else if (component.intValue() < 80) >177c224 >< Y = component - (X * 40); >--- >> Y = component.intValue() - (X * 40); >179,180c226,227 >< components[0] = X; >< components[1] = Y; >--- >> components[0] = BigInteger.valueOf(X); >> components[1] = BigInteger.valueOf(Y); >192c239 >< int tmp_components[]; >--- >> BigInteger tmp_components[]; >194c241 >< tmp_components = new int[components.length >--- >> tmp_components = new BigInteger[components.length >221c268,271 >< bytes.write((components[0] * 40) + components[1]); >--- >> /* We can use the int here because we know we are dealing >> with small numbers for the first byte >> */ >> bytes.write((components[0].intValue() * 40) + components[1].intValue()); >223c273 >< putComponent(bytes, components[i]); >--- >> putComponentBigInt(bytes, components[i]); >237c287 >< private static int getComponent(DerInputStream in) >--- >> private static BigInteger getComponentBigInt(DerInputStream in) >239d288 >< int retval, i, tmp; >241,242c290,294 >< for (i = 0, retval = 0; i < 4; i++) { >< retval <<= 7; >--- >> BigInteger retval = BigInteger.valueOf(0); >> int tmp; >> >> while (true) { >> retval = retval.shiftLeft(7); >244c296 >< retval |= (tmp & 0x07f); >--- >> retval = retval.or(BigInteger.valueOf(tmp & 0x07f)); >249d300 >< throw new IOException("X509.OID, component value too big"); >257c308 >< private static void putComponent(DerOutputStream out, int val) >--- >> private static void putComponentBigInt(DerOutputStream out, BigInteger val) >260c311,314 >< byte buf[] = new byte[4]; >--- >> int blockSize = 100; >> byte buf[] = new byte[blockSize]; >> >> BigInteger bigInt7f = BigInteger.valueOf(0x7f); >262,265c316,320 >< for (i = 0; i < 4; i++) { >< buf[i] = (byte) (val & 0x07f); >< val >>>= 7; >< if (val == 0) >--- >> BigInteger cur = new BigInteger(val.toString()); >> for (i = 0;; i++) { >> buf[i] = (cur.and(bigInt7f).byteValue()); >> cur = cur.shiftRight(7); >> if (cur.compareTo(BigInteger.ZERO) == 0 ) >294c349 >< if (other.components[i] < components[i]) >--- >> if (other.components[i].compareTo(components[i]) > 0) >322c377 >< if (components[i] != other.components[i]) >--- >> if (components[i].compareTo(other.components[i]) != 0 ) >335c390 >< h += components[i]; >--- >> h += components[i].intValue(); >362c417 >< * larger than 32 bits. Then we represent the path from the root as >--- >> * larger than 64 bits. Then we represent the path from the root as >365c420 >< private int components[]; // path from root >--- >> private BigInteger components[]; // path from root >425a481,531 >> } >> >> public static void main(String[] args) { >> >> long[] oid_components_long = { 1L, 3L,6L,1L,4L,1L,5000L,9L,1L,1L,1526913300628L, 1L}; >> int[] oid_components_int = { 1, 3,6,1,4,1,2312,9,1,1,15269, 1, 1}; >> BigInteger[] oid_components_big_int = { new BigInteger("1"), new BigInteger("3"), new BigInteger("6"), new BigInteger("1"), >> new BigInteger("4"), new BigInteger("1"), new BigInteger("2312"), >> new BigInteger("9"), new BigInteger("1"), >> new BigInteger("152691330062899999999999997777788888888888888889999999999999999"), new BigInteger("1") >> }; >> >> String oidIn = "1.3.6.1.4.1.2312.9.1.152691330062899999999999997777788888888888888889999999999999999.1"; >> ObjectIdentifier oid = new ObjectIdentifier(oidIn); >> >> ObjectIdentifier fromDer = null; >> ObjectIdentifier fromStaticMethod = null; >> ObjectIdentifier fromComponentList = null; >> ObjectIdentifier fromComponentListInt = null; >> ObjectIdentifier fromComponentListBigInt = null; >> >> System.out.println("oid: " + oid.toString()); >> >> DerOutputStream out = new DerOutputStream(); >> >> try { >> oid.encode(out); >> DerInputStream in = new DerInputStream(out.toByteArray()); >> fromDer = new ObjectIdentifier(in); >> >> System.out.println("fromDer: " + fromDer.toString()); >> >> fromStaticMethod = ObjectIdentifier.getObjectIdentifier(oidIn); >> >> System.out.println("fromStaticMethod: " + fromStaticMethod.toString()); >> >> fromComponentList = new ObjectIdentifier(oid_components_long); >> >> System.out.println("fromComponentList: " + fromComponentList.toString()); >> >> fromComponentListInt = new ObjectIdentifier(oid_components_int); >> >> System.out.println("fromComponentListInt: " + fromComponentListInt); >> >> fromComponentListBigInt = new ObjectIdentifier(oid_components_big_int); >> >> System.out.println("fromComponentListBigInt: " + fromComponentListBigInt); >> >> } catch (IOException e) { >> e.printStackTrace(); >> }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1577991
:
1439642
|
1441303
| 1447663