xalan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Chisholm (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (XALANC-742) XalanVector assignment operator crash bug
Date Wed, 10 Apr 2013 21:09:16 GMT

    [ https://issues.apache.org/jira/browse/XALANC-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13628251#comment-13628251

Michael Chisholm commented on XALANC-742:

Actually, once those extra braces are in, it seems to work on linux (RHEL5, gcc 4.1.2).  It
still crashes on Windows.  It seems to be at a debug pointer check:


(I built the test app in debug mode.)  In release mode, it works since I guess the check doesn't
occur, and for whatever reason, it doesn't choke on a NULL destination pointer.

I think that the impls I've looked at optimize the std::copy() call to std::memmove(), so
it may boil down to whether memmove() allows a NULL destination pointer.  Here is some discussion
I found about that:


there is a quote from the c99 standard that says the pointers may not be NULL.  So I think
this does need fixing.

> XalanVector assignment operator crash bug
> -----------------------------------------
>                 Key: XALANC-742
>                 URL: https://issues.apache.org/jira/browse/XALANC-742
>             Project: XalanC
>          Issue Type: Bug
>          Components: XalanC
>    Affects Versions: CurrentCVS, 1.11
>         Environment: Tested on Windows 7
>            Reporter: Michael Chisholm
>            Assignee: Steven J. Hathaway
>            Priority: Critical
> When assigning an empty XalanVector to another, a NULL dereference and crash results.
 Specifically, the std::copy() statement copies to this->begin(), which returns NULL when
the vector is empty.
> Here is simple demo code:
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xalanc/Include/XalanVector.hpp>
> using namespace xercesc;
> using namespace xalanc;
> int main(int argc, char* argv[])
> {
> 	XMLPlatformUtils::Initialize();
> 	XalanVector<int> vec1;
> 	XalanVector<int> vec2(XalanMemMgrs::getDefaultXercesMemMgr(), 5);
> 	vec1 = vec2;
> 	XMLPlatformUtils::Terminate();
> 	return 0;
> }

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

To unsubscribe, e-mail: dev-unsubscribe@xalan.apache.org
For additional commands, e-mail: dev-help@xalan.apache.org

View raw message