You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Mike Beckerle (Jira)" <ji...@apache.org> on 2023/05/25 15:19:00 UTC

[jira] [Commented] (DAFFODIL-2660) prefixLengthType needs to evaluate asserts before using the prefix value

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

Mike Beckerle commented on DAFFODIL-2660:
-----------------------------------------

Update: DFDL-Workgroup has decided on an approach to this and an official erratum to the spec now addresses this.

The fix is that facets expressed on a prefixLengthType which can be max/min exclusive/inclusive, are always checked, and it is a processing error if the value of the length violates this. 

Implementations are responsible to implement their own flags, if necessary, to disable this, if backward compatibility is required. 

I believe there will also be a stipulation that statement annotations are not allowed on the simpleType used as a prefixLengthType. 

> prefixLengthType needs to evaluate asserts before using the prefix value
> ------------------------------------------------------------------------
>
>                 Key: DAFFODIL-2660
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2660
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End, Diagnostics
>    Affects Versions: 3.2.1
>            Reporter: Mike Beckerle
>            Priority: Major
>
> We want to use lengthKind 'prefixed' and avoid the complexity of dfdl:outputValueCalc and dfdl:lengthKind 'explicit' with a length expression.
> But... using prefixed is much less robust, because the prefix value is currently used to pull data (when parsing) and assertions expressed on the prefixLengthType seem to never be evaluated.
> E.g., below we have a prefixed-length field named 'payload'.
> The range is only 0 to 32768, but this assert never executes. 
> {code:java}
>         ...
>         <complexType>
>           <sequence>
>             <element name="payload" type="xs:hexBinary"
>                      dfdl:lengthKind="prefixed"
>                      dfdl:prefixIncludesPrefixLength="no"
>                      dfdl:prefixLengthType="p8:bufferPayload"/>
>           </sequence>
>         </complexType>
>         ...
> <simpleType name="bufferPayload">
>   <annotation>
>     <appinfo source="http://www.ogf.org/dfdl/">
>       <dfdl:assert>{ dfdl:checkConstraints(.) }</dfdl:assert>
>     </appinfo>
>   </annotation>
>   <restriction base="p8:unsignedLong">
>     <minInclusive value="0"/>
>     <maxInclusive value="32768"/>
>   </restriction>
> </simpleType> {code}
> The assert needs to execute before the prefix value is used as a length. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)