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

Steven J. Hathaway commented on XALANC-744:
-------------------------------------------

Tom,
Thanks for your finding.  I will again review the code and commit - or define 
another fix.


> XalanLocator::getSystemId() can return NULL, cause crash
> --------------------------------------------------------
>
>                 Key: XALANC-744
>                 URL: https://issues.apache.org/jira/browse/XALANC-744
>             Project: XalanC
>          Issue Type: Bug
>          Components: XalanC
>    Affects Versions: 1.11
>         Environment: Windows, Visual Studio 2010
>            Reporter: Michael Chisholm
>            Assignee: Steven J. Hathaway
>            Priority: Critical
>
> I think this is a copy-paste bug, introduced in r1388736:
> Index: XalanLocator.hpp
> ===================================================================
> --- XalanLocator.hpp    (revision 1388735)
> +++ XalanLocator.hpp    (revision 1388736)
> @@ -67,17 +67,19 @@
>      static const XalanDOMChar*
>      getPublicId(
>              const Locator*          theLocator,
> -            const XalanDOMChar*     theAlternateId = 0)
> +            const XalanDOMChar*     theAlternateId = &s_dczero)
>      {
> -        return theLocator == 0 ? theAlternateId : theLocator->getPublicId();
> +        return theLocator == 0 ? theAlternateId : (theLocator->getPublicId() 
> ?
> +            theLocator->getPublicId() : theAlternateId);
>      }
>      static const XalanDOMChar*
>      getSystemId(
>              const Locator*          theLocator,
> -            const XalanDOMChar*     theAlternateId = 0)
> +            const XalanDOMChar*     theAlternateId = &s_dczero)
>      {
> -        return theLocator == 0 ? theAlternateId : theLocator->getSystemId();
> +        return theLocator == 0 ? theAlternateId : (theLocator->getSystemId() 
> ?
> +            theLocator->getPublicId() : theAlternateId);
>      }
>      static XalanFileLoc
> @@ -122,6 +124,8 @@
>      XalanLocator&
>      operator=(const XalanLocator&);
> +
> +    const static XalanDOMChar s_dczero = 0;
>  };
> Notice that in the getSystemId() method, theLocator->getPublicId() is called. 
>  I think that was meant to be theLocator->getSystemId().  This caused a crash 
> when I used Xalan.exe because it sets up its XSLTInputSources with system 
> Ids, but not public Ids.  Then, during transformation, 
> XalanLocator::getSystemId() is called, which returns the NULL public Id, 
> which is passed to the XalamDomString constructor, which causes the crash.
> I just switched the call to theLocator->getSystemId() and the crash 
> disappeared.



--
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