xalan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven J. Hathaway (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (XALANC-744) XalanLocator::getSystemId() can return NULL, cause crash
Date Tue, 24 Sep 2013 21:35:04 GMT

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

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

Patch committed to resolve this issue.
getSystemId() now either returns getSystemId() or the empty string.
It no longer causes a return of getPublicId.

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


Mime
View raw message