StAX
  1. StAX
  2. STAX-24

Reading entities with fairly large data (> 20 MByte) results in variable overflow which eventually leads to XMLStreamException.

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Number of attachments :
      0

      Description

      My XML files can contain base64 encoded binary data, stored as text node in tags, which can be fairly large ( > 20 MByte... hum... sorry !). Such XML files cannot be read by StAX due to variable overflow in MXParser.java:

      in fillBuf function, bufSoftLimit overflows when buf.length > 21MByte in:

      bufSoftLimit = ( bufLoadFactor * buf.length ) /100;

      Should rather be:

      bufSoftLimit = (int) ((((double) bufLoadFactor) / 100) * buf.length);

      Or, better, bufLoadFactor should be declared as:

      protected double bufLoadFactor = 0.95; // instead of protected int bufLoadFactor = 95;

      and the above formula should be:

      bufSoftLimit = bufLoadFactor * buf.length;

      However, since bufLoadFactor is declared as protected, I am not sure that changing the type won't break compatibility...

      Regards,
      Stéphane El Guedj

        Activity

        Hide
        Tatu Saloranta added a comment -

        Fascinating. I'll have a look soon and fix this one – should be easy enough. Not sure of an easy way to test it though (should write a synthetic test case that generates such content in memory and parse it).

        Show
        Tatu Saloranta added a comment - Fascinating. I'll have a look soon and fix this one – should be easy enough. Not sure of an easy way to test it though (should write a synthetic test case that generates such content in memory and parse it).

          People

          • Assignee:
            Tatu Saloranta
            Reporter:
            Stéphane El Guedj
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: