decode() counted '=' anywhere in the last six characters and treated
any count outside {1,3,4,6} as unpadded. With two or five pad
characters nQuantumBytes became 0, so the output buffer was returned
with bytes that were never written, and the byte-extraction offset
became -8, shifting by a negative amount.
Count only the trailing run of pad characters, reject counts RFC 4648
does not allow, and reject a '=' that is not part of that run.
The bug that was fixed, was affecting how the number of bytes of decoded data was calculated and thus, even though it didn't truncate the result, it was causing the array to be resized unnecessarily.