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

Steve Lawrence commented on DAFFODIL-412:
-----------------------------------------

Yeah, the maximumRegexMatchLengthInCharacters tunabe will limit how far ahead a 
pattern lengthKind or pattern assert will scan. So that part of the bug is 
already resolved.

Though, I believe when we hit this limit without finding a match, we stop 
looking any further and consider it "no match". In the assert pattern case "no 
match" casues the assert to fail, and in the lengthKind case it just means the 
length is zero. We've had times where this behavior is not intuitive and leads 
to unexpected failures. So the reamaining part of this bug is about adding a 
warning when we seem appear to be overscanning due. One option is to just 
output a warning when we hit this limit. There might be some other heuristics 
we can use to output a warning, like if we go out of the bounds of a parent 
element with specified length–length kind pattern normally ignores parent 
bounds.

> asserts and discriminators with testKind pattern should have warning on 
> too-long match
> --------------------------------------------------------------------------------------
>
>                 Key: DAFFODIL-412
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-412
>             Project: Daffodil
>          Issue Type: Improvement
>          Components: Back End, Diagnostics, Front End, Usability
>    Affects Versions: s5
>            Reporter: Mike Beckerle
>            Priority: Major
>
> When an assert/discriminator is of testKind pattern the pattern test passes 
> if the regex matches a prefix of the data stream at the start of the element 
> This match attempt is not bounded by the length of the element.
> It's entirely possible for a very bad regex pattern to cause massive scanning 
> of the data stream before returning a match or a failure.
> Our runtime should emit warnings if this is happening i.e., an attempt to 
> match a regex that consumes more than N characters should emit a warning, 
> then every N more characters, etc.
> A tunable limit should be created for this regex lookahead/match so that we 
> can force a failure here. The Daffodil API should provide a way to set this 
> tunable limit.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to