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

DerValue does not accept empty OCTET STRING

XMLWordPrintable

    • b50
    • generic, x86
    • generic, linux
    • Verified

      When creating a DerValue with 04 00 and then try to read the content, an NPE is thrown.

      The reason is that buffer is not assigned a non-null value if length == 0:

          private DerInputStream init(boolean fullyBuffered, InputStream in)
                  throws IOException {
              ....
              if (length == 0)
                  return null;
              ....
              buffer = new DerInputBuffer(bytes);
              ....
          }

          public byte[] getOctetString() throws IOException {
                  byte[] bytes;
              ....
              if (buffer.read(bytes) != length)
              ....
          }

            weijun Weijun Wang
            weijun Weijun Wang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: