JDK-8077321 : XMLSignatureInput cannot process a file larger than 1GB
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.xml.crypto
  • Affected Version: 7u76
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2015-04-09
  • Updated: 2015-12-14
  • Resolved: 2015-08-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7u95 b01Fixed
Related Reports
Relates :  
Relates :  
Description
The following code snippet causes failure if the file 'filename' size is greater than 1G:
FileInputStream in = new FileInputStream(fileName);
XMLSignatureInput a = new XMLSignatureInput(in);
a.getOctetStream();    // OutOfMemoryError occurs at this line.

Stack trace with failure:
java.lang.OutOfMemoryError: Requested array size exceeds VM limit
	at com.sun.org.apache.xml.internal.security.utils.UnsyncByteArrayOutputStream.expandSize(UnsyncByteArrayOutputStream.java:100)
	at com.sun.org.apache.xml.internal.security.utils.UnsyncByteArrayOutputStream.write(UnsyncByteArrayOutputStream.java:64)
	at com.sun.org.apache.xml.internal.security.utils.JavaUtils.getBytesFromStream(JavaUtils.java:125)
	at com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput.getResetableInputStream(XMLSignatureInput.java:565)
	at com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput.getOctetStream(XMLSignatureInput.java:272)
	at Main.main(Main.java:10)