[ 
https://issues.apache.org/jira/browse/DAFFODIL-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16495162#comment-16495162
 ] 

Steve Lawrence commented on DAFFODIL-1704:
------------------------------------------

A user recently hit this bug. They had an xs:unsignedInt with a bit length of 
64. This parsed successfully without any errors, but ended up causeing errors 
on unparse due to DAFFODIL-1681.

Note that section 12.3.7.2 says the following:
{quote}
It is a schema definition error if the specified dfdl:length for an element of 
dfdl:lengthKind 'explicit' is a string literal integer such that the length of 
the data exceeds the capacity of the simple type.

It is a processing error if the specified length for an element of 
dfdl:lengthKInd 'prefixed' or 'explicit' (with dfdl:length an expression) is an 
integer such that the length of the data exceeds the capacity of the simple 
type.
{quote}

So with a non-expression length, it should be an SDE at compile time. With an 
expression length, it should be a PE at runtime.

> PE undetected - Binary number parsers are missing checks for bitLength
> ----------------------------------------------------------------------
>
>                 Key: DAFFODIL-1704
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1704
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End, General
>    Affects Versions: 2.0.0
>            Reporter: Elizabeth Fahl
>            Priority: Major
>             Fix For: deferred
>
>
> This was discussed in a review of boolean parser and unparser, which have a 
> check for bitLength that the binary number parsers do not. These checks would 
> verify that bitLength falls within the accepted range for it's type as noted 
> in 12.3.7.2.1 in the spec. It also needs to be determined if this check would 
> be better in an evaluatable so it could be done at compile time.
> The check in BinaryBooleanParsers.scala:
> {code}
>     val nBits = getBitLength(start)
>     if (nBits < 1 || nBits > 32) {
>       PE(start, "Number of bits %d out of range, must be between 1 and 32 
> bits.", nBits)
>       return
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to