Discussion:
[jira] [Commented] (XALANC-744) XalanLocator::getSystemId() can return NULL, cause crash
Steven J. Hathaway (JIRA)
2013-09-24 21:35:04 UTC
Permalink
[ 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
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
Scott Yuan (JIRA)
2014-04-22 05:30:16 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANC-744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13976407#comment-13976407 ]

Scott Yuan commented on XALANC-744:
-----------------------------------

Thanks! Just ran into the same getSystemId() return NULL causing crash issue and is very glad that it's been fixed.
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
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.2#6252)
Tom Gundrum (JIRA)
2015-04-30 17:05:06 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANC-744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14521852#comment-14521852 ]

Tom Gundrum commented on XALANC-744:
------------------------------------

We are seeing this issue in the downloaded version of 1.11. Could you merge this fix back into the branch version 1.11?
Thanks!
Tom
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
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: dev-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org
Steven J. Hathaway (JIRA)
2015-05-06 06:42:00 UTC
Permalink
[ 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
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: dev-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org

Loading...