> PKCS12KeyStore.loadSafeContents() reads valSet[0] for friendlyName and 
> localKeyId attributes without checking whether their DER SET contains any 
> values.
> 
> DerInputStream.getSet(1) accepts an empty SET; the argument controls initial 
> collection capacity rather than a minimum element count. A malformed PKCS12 
> bag attribute containing SET encoding 3100 therefore produces a zero-length 
> array and triggers ArrayIndexOutOfBoundsException during KeyStore.load(). The 
> unencrypted content path can encounter the error with a null password.
> 
> Expected behavior: invalid attribute encodings must produce the normal 
> IOException parsing failure instead of an unchecked indexing exception.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Timofei Fedotov has updated the pull request incrementally with two additional 
commits since the last revision:

 - Move empty attribute value checks to individual branches
 - Use Asserts in EmptyAttributeSet test

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/33864/files
  - new: https://git.openjdk.org/jdk/pull/33864/files/c6515535..661aa948

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=33864&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=33864&range=01-02

  Stats: 25 lines in 2 files changed: 10 ins; 4 del; 11 mod
  Patch: https://git.openjdk.org/jdk/pull/33864.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/33864/head:pull/33864

PR: https://git.openjdk.org/jdk/pull/33864

Reply via email to