You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Patrick Hagelkruys (JIRA)" <ji...@apache.org> on 2011/04/15 22:26:05 UTC

[jira] [Created] (SANTUARIO-268) TXFMXPathFilter->evaluateExpr crashes on Windows

TXFMXPathFilter->evaluateExpr crashes on Windows
------------------------------------------------

                 Key: SANTUARIO-268
                 URL: https://issues.apache.org/jira/browse/SANTUARIO-268
             Project: Santuario
          Issue Type: Bug
          Components: C++
    Affects Versions: C++ 1.6.0
         Environment: Windows, Visual Studio 2005
            Reporter: Patrick Hagelkruys
            Assignee: Scott Cantor


In the evaluateExpr function of the TXFMXPathFilter class, the iteration over the std::vector crashes, caused by the for loop.
The iterator is set to std::vector->begin and incremeted before the fist loop run, changing the loop incrementer from ++i to i++ fixed this problem. This only crashes if the std::vector hast only one item. 


The evaluateExpr function of the TXFMXPathFilter class takes an std::vector as Parameter. Passing std::vector accross DLLs does not allways work on Windows, and its recommended not to do that. 

As solution I added an class function taking an sinlge DSIGXPathFilterExpr as parameter, creating an std::vector array with this filter and passing the filter to the evaluateExpr function. 



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SANTUARIO-268) TXFMXPathFilter->evaluateExpr crashes on Windows

Posted by "Scott Cantor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANTUARIO-268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020439#comment-13020439 ] 

Scott Cantor commented on SANTUARIO-268:
----------------------------------------

I see other cases that need fixing, but FYI, that can't be your crash, at least not directly. A for loop iterator doesn't get bumped until the bottom of a loop, not the beginning:

for (a; b; c) {}
is

a
while (b) {
 c
}

It's possible something implementation specific on Windows is going on, but in general a stand alone post vs pre increment only differs by what it returns, not the effect on the iterator. Pre-increment is favored in STL because it's usually more efficient.

> TXFMXPathFilter->evaluateExpr crashes on Windows
> ------------------------------------------------
>
>                 Key: SANTUARIO-268
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-268
>             Project: Santuario
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: C++ 1.6.0
>         Environment: Windows, Visual Studio 2005
>            Reporter: Patrick Hagelkruys
>            Assignee: Scott Cantor
>         Attachments: patch.txt
>
>
> In the evaluateExpr function of the TXFMXPathFilter class, the iteration over the std::vector crashes, caused by the for loop.
> The iterator is set to std::vector->begin and incremeted before the fist loop run, changing the loop incrementer from ++i to i++ fixed this problem. This only crashes if the std::vector hast only one item. 
> The evaluateExpr function of the TXFMXPathFilter class takes an std::vector as Parameter. Passing std::vector accross DLLs does not allways work on Windows, and its recommended not to do that. 
> As solution I added an class function taking an sinlge DSIGXPathFilterExpr as parameter, creating an std::vector array with this filter and passing the filter to the evaluateExpr function. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (SANTUARIO-268) TXFMXPathFilter->evaluateExpr crashes on Windows

Posted by "Scott Cantor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANTUARIO-268?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Cantor resolved SANTUARIO-268.
------------------------------------

    Resolution: Fixed

All instances of < end() have been replaced with != end().

> TXFMXPathFilter->evaluateExpr crashes on Windows
> ------------------------------------------------
>
>                 Key: SANTUARIO-268
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-268
>             Project: Santuario
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: C++ 1.6.0
>         Environment: Windows, Visual Studio 2005
>            Reporter: Patrick Hagelkruys
>            Assignee: Scott Cantor
>         Attachments: patch.txt
>
>
> In the evaluateExpr function of the TXFMXPathFilter class, the iteration over the std::vector crashes, caused by the for loop.
> The iterator is set to std::vector->begin and incremeted before the fist loop run, changing the loop incrementer from ++i to i++ fixed this problem. This only crashes if the std::vector hast only one item. 
> The evaluateExpr function of the TXFMXPathFilter class takes an std::vector as Parameter. Passing std::vector accross DLLs does not allways work on Windows, and its recommended not to do that. 
> As solution I added an class function taking an sinlge DSIGXPathFilterExpr as parameter, creating an std::vector array with this filter and passing the filter to the evaluateExpr function. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (SANTUARIO-268) TXFMXPathFilter->evaluateExpr crashes on Windows

Posted by "Patrick Hagelkruys (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANTUARIO-268?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hagelkruys updated SANTUARIO-268:
-----------------------------------------

    Attachment: patch.txt

patch file with the descripted changes

> TXFMXPathFilter->evaluateExpr crashes on Windows
> ------------------------------------------------
>
>                 Key: SANTUARIO-268
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-268
>             Project: Santuario
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: C++ 1.6.0
>         Environment: Windows, Visual Studio 2005
>            Reporter: Patrick Hagelkruys
>            Assignee: Scott Cantor
>         Attachments: patch.txt
>
>
> In the evaluateExpr function of the TXFMXPathFilter class, the iteration over the std::vector crashes, caused by the for loop.
> The iterator is set to std::vector->begin and incremeted before the fist loop run, changing the loop incrementer from ++i to i++ fixed this problem. This only crashes if the std::vector hast only one item. 
> The evaluateExpr function of the TXFMXPathFilter class takes an std::vector as Parameter. Passing std::vector accross DLLs does not allways work on Windows, and its recommended not to do that. 
> As solution I added an class function taking an sinlge DSIGXPathFilterExpr as parameter, creating an std::vector array with this filter and passing the filter to the evaluateExpr function. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SANTUARIO-268) TXFMXPathFilter->evaluateExpr crashes on Windows

Posted by "Patrick Hagelkruys (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANTUARIO-268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020440#comment-13020440 ] 

Patrick Hagelkruys commented on SANTUARIO-268:
----------------------------------------------

Thanks for the adive on STL, i will try another more modern compiler. 

> TXFMXPathFilter->evaluateExpr crashes on Windows
> ------------------------------------------------
>
>                 Key: SANTUARIO-268
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-268
>             Project: Santuario
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: C++ 1.6.0
>         Environment: Windows, Visual Studio 2005
>            Reporter: Patrick Hagelkruys
>            Assignee: Scott Cantor
>         Attachments: patch.txt
>
>
> In the evaluateExpr function of the TXFMXPathFilter class, the iteration over the std::vector crashes, caused by the for loop.
> The iterator is set to std::vector->begin and incremeted before the fist loop run, changing the loop incrementer from ++i to i++ fixed this problem. This only crashes if the std::vector hast only one item. 
> The evaluateExpr function of the TXFMXPathFilter class takes an std::vector as Parameter. Passing std::vector accross DLLs does not allways work on Windows, and its recommended not to do that. 
> As solution I added an class function taking an sinlge DSIGXPathFilterExpr as parameter, creating an std::vector array with this filter and passing the filter to the evaluateExpr function. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (SANTUARIO-268) TXFMXPathFilter->evaluateExpr crashes on Windows

Posted by "Scott Cantor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANTUARIO-268?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Cantor updated SANTUARIO-268:
-----------------------------------

    Fix Version/s: C++ 1.6.1

> TXFMXPathFilter->evaluateExpr crashes on Windows
> ------------------------------------------------
>
>                 Key: SANTUARIO-268
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-268
>             Project: Santuario
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: C++ 1.6.0
>         Environment: Windows, Visual Studio 2005
>            Reporter: Patrick Hagelkruys
>            Assignee: Scott Cantor
>             Fix For: C++ 1.6.1
>
>         Attachments: patch.txt
>
>
> In the evaluateExpr function of the TXFMXPathFilter class, the iteration over the std::vector crashes, caused by the for loop.
> The iterator is set to std::vector->begin and incremeted before the fist loop run, changing the loop incrementer from ++i to i++ fixed this problem. This only crashes if the std::vector hast only one item. 
> The evaluateExpr function of the TXFMXPathFilter class takes an std::vector as Parameter. Passing std::vector accross DLLs does not allways work on Windows, and its recommended not to do that. 
> As solution I added an class function taking an sinlge DSIGXPathFilterExpr as parameter, creating an std::vector array with this filter and passing the filter to the evaluateExpr function. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SANTUARIO-268) TXFMXPathFilter->evaluateExpr crashes on Windows

Posted by "Scott Cantor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANTUARIO-268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020432#comment-13020432 ] 

Scott Cantor commented on SANTUARIO-268:
----------------------------------------

Thanks. The fix is actually to compare directly to end() rather than use < or > logic, that's not how STL works. I'll see if I can find any other cases like that.

As for the interface, passing STL objects across DLLs works fine in modern compilers and systems and obviously it would be a breaking API change to alter it. But there's really no need to; you might want to inquire on the list if you're having an issue with it.

But it is most definitely acceptable to do that. Anything suggesting otherwise is either mistaken or out of date.

> TXFMXPathFilter->evaluateExpr crashes on Windows
> ------------------------------------------------
>
>                 Key: SANTUARIO-268
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-268
>             Project: Santuario
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: C++ 1.6.0
>         Environment: Windows, Visual Studio 2005
>            Reporter: Patrick Hagelkruys
>            Assignee: Scott Cantor
>         Attachments: patch.txt
>
>
> In the evaluateExpr function of the TXFMXPathFilter class, the iteration over the std::vector crashes, caused by the for loop.
> The iterator is set to std::vector->begin and incremeted before the fist loop run, changing the loop incrementer from ++i to i++ fixed this problem. This only crashes if the std::vector hast only one item. 
> The evaluateExpr function of the TXFMXPathFilter class takes an std::vector as Parameter. Passing std::vector accross DLLs does not allways work on Windows, and its recommended not to do that. 
> As solution I added an class function taking an sinlge DSIGXPathFilterExpr as parameter, creating an std::vector array with this filter and passing the filter to the evaluateExpr function. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SANTUARIO-268) TXFMXPathFilter->evaluateExpr crashes on Windows

Posted by "Scott Cantor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANTUARIO-268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020442#comment-13020442 ] 

Scott Cantor commented on SANTUARIO-268:
----------------------------------------

The one you have is fine, I was doing this kind of thing with MSVC 6. You may be having problems because you're using a static C/C++ runtime instead of the DLL runtime.

> TXFMXPathFilter->evaluateExpr crashes on Windows
> ------------------------------------------------
>
>                 Key: SANTUARIO-268
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-268
>             Project: Santuario
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: C++ 1.6.0
>         Environment: Windows, Visual Studio 2005
>            Reporter: Patrick Hagelkruys
>            Assignee: Scott Cantor
>         Attachments: patch.txt
>
>
> In the evaluateExpr function of the TXFMXPathFilter class, the iteration over the std::vector crashes, caused by the for loop.
> The iterator is set to std::vector->begin and incremeted before the fist loop run, changing the loop incrementer from ++i to i++ fixed this problem. This only crashes if the std::vector hast only one item. 
> The evaluateExpr function of the TXFMXPathFilter class takes an std::vector as Parameter. Passing std::vector accross DLLs does not allways work on Windows, and its recommended not to do that. 
> As solution I added an class function taking an sinlge DSIGXPathFilterExpr as parameter, creating an std::vector array with this filter and passing the filter to the evaluateExpr function. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira