[ 
https://issues.apache.org/jira/browse/XERCESC-1994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Scott Cantor resolved XERCESC-1994.
-----------------------------------
    Resolution: Fixed

Added to 3.1 branch, r1662870

> ContentSpecNode::getMaxTotalRange: Operator precedence flaw
> -----------------------------------------------------------
>
>                 Key: XERCESC-1994
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1994
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 3.1.1
>         Environment: Not relevant, C++ syntax problem
>            Reporter: Michael Gmelin
>            Assignee: Alberto Massari
>             Fix For: 3.1.2, 3.2.0
>
>         Attachments: ContentSpecNode.cpp.patch
>
>
> ContentSpecType.cpp says at about line 260:
>                 if ((fType & 0x0f) == ContentSpecNode::Choice) {
>                     max = max * (maxFirst > maxSecond) ? maxFirst : maxSecond;
>                 }
> Thanks to operator precedence max evaluates either to maxFirst or maxSecond, 
> but never to max*maxFirst or max*maxSecond.
> Adding parenthesis makes this do the right thing:
>                     max = max * ((maxFirst > maxSecond) ? maxFirst : 
> maxSecond);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to