You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Steven J. Hathaway (JIRA)" <ji...@apache.org> on 2012/09/21 07:29:08 UTC

[jira] [Commented] (XALANC-733) Ensure that XalanLocator::getSystemId() and getPublicId() do not return NULL

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

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

Martin,

I recommend fixing the issue in 
   xalanc/PlatformSupport/XalanLocator.hpp 
instead of in 
   xalanc/PlatformSupport/XSLException.cpp

A fix here should fix other attempts to initialize an XalanDOMString
with the reference to a NULL pointer.  Your usoft patch ensures that 
XalanDOMString url is initialized to an empty string when the Xerces
Locator::getSystemId() returns a NULL.

The patch recommended for xalanc/PlatformSupport/XalanLocator.hpp
means that &s_dummy is no longer required to be in the source for
xalanc/PlatformSupport/XSLException.cpp

SOME PATCH INFORMATION :: STRUCTURAL ANALYSIS

[1] The XERCESC sax/Locator.hpp

  class SAX_EXPORT Locator
  {
  public:
    virtual const XMLCh* getPublicId() const = 0;
    virtual const XMLCh* getSystemId() const = 0;
  }

  The XMLCh* return values may be NULL if these methods are not implemented.

[2] The XALANC PlatformSupport/XalanLocator.hpp

  XALAN_USING_XERCES(Locator)

  class XALAN_PLATFORMSUPPORT_EXPORT XalanLocator : public Locator
  {
  public:
    virtual const XMLCh*
    getPublicId() const = 0;

    virtual const XMLCh*
    getSystemId() const = 0;

    virtual XalanFileLoc
    getLineNumber() const = 0;

    virtual XalanFileLoc
    getColumnNumber() const = 0;

    static const XalanDOMChar*
    getPublicId(
            const Locator*          theLocator,
//          const XalanDOMChar*     theAlternateId = 0)        // OLD a NULL value
            const XalanDOMChar*     theAlternateId = &(0))     // NEW address of value zero
    {
//      return theLocator == 0 ? theAlternateId : theLocator->getPublicId();     // OLD
        return theLocator == 0 ? theAlternateId : theLocator->getPublicId() ?    // NEW
            theLocator->getSystemId() : theAlternateId);                         // NEW
    }

    static const XalanDOMChar*
    getSystemId(
            const Locator*          theLocator,
//          const XalanDOMChar*     theAlternateId = 0)        // OLD a NULL value
            const XalanDOMChar*     theAlternateId = &(0))     // NEW address of value zero
    {
//      return theLocator == 0 ? theAlternateId : theLocator->getSystemId();     // OLD
        return theLocator == 0 ? theAlternateId : (theLocator->getSystemId() ?   // NEW
            theLocator->getSystemId() : theAlternateId);                         // NEW
    }

//    Note:  If theAlternateId is not passed as a parameter, the default is NULL.
//           We may want the default to be an address of a zero value so that
//           initializing an XalanDOMString does not fault.

===================================

The recommended patch to "xalanc/PlatformSupport/XalanLocator.hpp"
ensures that getSystemId() and getPublicId() do not return NULL pointers.

XalanC source files that can benefit from the above patch include:

xalanc/PlatformSupport/ProblemListenerBase.cpp
xalanc/PlatformSupport/XSLException.cpp
xalanc/XPath/XPathExecutionContextDefault.cpp

===================================

Sincerely,
Steven J. Hathaway
Xalan Documentation Project

                
> Ensure that XalanLocator::getSystemId() and getPublicId() do not return NULL
> ----------------------------------------------------------------------------
>
>                 Key: XALANC-733
>                 URL: https://issues.apache.org/jira/browse/XALANC-733
>             Project: XalanC
>          Issue Type: Bug
>          Components: XalanC, XPathC
>    Affects Versions: 1.11
>            Reporter: Steven J. Hathaway
>            Assignee: Steven J. Hathaway
>
> The recommended patch to "xalanc/PlatformSupport/XalanLocator.hpp"
> ensures that getSystemId() and getPublicId() do not return NULL pointers.
> XalanC source files that can benefit from the patch include:
> xalanc/PlatformSupport/ProblemListenerBase.cpp
> xalanc/PlatformSupport/XSLException.cpp
> xalanc/XPath/XPathExecutionContextDefault.cpp
> The patch will be submitted shortly.

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