Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8077321

XMLSignatureInput cannot process a file larger than 1GB

    XMLWordPrintable

    Details

      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)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aefimov Aleksej Efimov
              Reporter:
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: