Mike Beckerle created DAFFODIL-2688:
---------------------------------------

             Summary: prefixed length field when not enough bits available 
gives Runtime SDE not parse error
                 Key: DAFFODIL-2688
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2688
             Project: Daffodil
          Issue Type: Bug
          Components: Back End
    Affects Versions: 3.3.0
            Reporter: Mike Beckerle


When a prefixed length, let's say a 4-byte unsigned int, is being parsed, and 
there are not 32-bits available (because, for example you are at end of data), 
then you don't get a parse error. Instead you get:
{code:java}
Runtime Schema Definition Error: Prefixed length result must be non-negative 
after dfdl:prefixIncludesPrefixLength adjustment , but was: -4 {code}
This needs to be a parse error due to the insufficient bits. 

If you trace, you get this:
{code:java}
parser: <BinaryIntegerKnownLengthParser/>
bitPosition: 1920
data:
            │                                        │
  87654321  0011 2233 4455 6677 8899 aabb ccdd eeff  0123456789abcdef
infoset:
  <?xml version="1.0" encoding="UTF-8"?>
  <message (prefixLength)></message (prefixLength)>
diff:
  (no differences)
failure:
  Parse Error: Insufficient bits in data. Needed 32 bit(s) but found only 0 
available.
  Schema context: message (prefixLength) Location line 385 in 
file:/....../common.dfdl.xsd
  Data location was preceding byte 240 limit(bytes) 240
----------------------------------------------------------------- 
347org.apache.daffodil.tdml.TDMLExceptionImpl: (Implementation: daffodil) 
Runtime Schema Definition Error: Prefixed length result must be non-negative 
after dfdl:prefixIncludesPrefixLength adjustment , but was: -4 {code}
So you can see how it's just out of data, yet getting an RSDE on this. 

 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to