8392044: AVX-512 Base64 decoder overwrites output buffer on short padded tail by albertnetymk · Pull Request #32781 · openjdk/jdk

· GitHub

2 min read Original article ↗

In StubGenerator::generate_base64_decodeBlock() (x86_64 AVX-512 VBMI path), L_finalBit handles 1-63 leftover bytes with a masked vector sequence that computes output_size = (len/4)*3. Valid inputs always have a length multiple of 4, so this bug triggers only on invalid inputs: with length < 4 (e.g. "A".repeat(64)+"=" leaves 1 byte after L_process64Loop), output_size starts at 0 and the padding path decrements it below zero, producing a wrong output_mask. The stub stores past the logical output length before returning to Java, corrupting the heap.

The suggested fix is to early-return to Java if length < 4.



Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Integration blocker

 ⚠️ Failed to retrieve information on issue 8392044. Please make sure it exists and is accessible.

Issue

  • ⚠️ Failed to retrieve information on issue 8392044.

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/32781/head:pull/32781
$ git checkout pull/32781

Update a local copy of the PR:
$ git checkout pull/32781
$ git pull https://git.openjdk.org/jdk.git pull/32781/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 32781

View PR using the GUI difftool:
$ git pr show -t 32781

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/32781.diff