Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-32012

[GSS](8.1.z) Regression in Jakarta XML Bind: parseBase64Binary length restriction (< 3 bytes) in EAP 8.x

XMLWordPrintable

      Eap version 8.1.3
      jakarta.xml.bind-api version: 4.0.2.redhat-00003

      The customer is encountering an issue with the `jakarta.xml.bind.DatatypeConverter#parseBase64Binary` method, which throws an `IllegalArgumentException` with the message "base64 text invalid." when the decoded output is less than 3 bytes. This problem arises due to a discrepancy in the length check within the `DatatypeConverterImpl` class in JBoss EAP 8.x.x environments. The standard implementation in the Jakarta EE JXB API allows for Base64 strings with lengths that are not multiples of 4, whereas the JBoss EAP version enforces a minimum length of 3 bytes.

      This apparently incorrect check in DatatypeConverterImpl from https://mvnrepository.com/artifact/jakarta.xml.bind/jakarta.xml.bind-api/4.0.2.redhat-00003

      final int buflen = guessLength(text);
      if (buflen < 3)

      { throw new IllegalArgumentException("base64 text invalid."); }

      which differs from the standard-implementation of jakarta.xml.bind.DatatypeConverter at https://github.com/jakartaee/jaxb-api/blob/master/api/src/main/java/jakarta/xml/bind/DatatypeConverterImpl.java

      if (null == text || text.length() % 4 != 0) { throw new IllegalArgumentException("base64 text invalid."); }

              lvydra Lukas Vydra
              rhn-support-bmaxwell Brad Maxwell
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: