You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/07/18 16:22:38 UTC

DO NOT REPLY [Bug 21710] New: - xalanc_1_5::XalanArrayAllocator::reset() function has a bug

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21710>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21710

xalanc_1_5::XalanArrayAllocator<void const *>::reset() function has a bug

           Summary: xalanc_1_5::XalanArrayAllocator<void const *>::reset()
                    function has a bug
           Product: XalanC
           Version: 1.5
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: XalanC
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: vsyssik@billing.ru


xalanc_1_5::XalanArrayAllocator<void const *>::reset() function has a bug in 
file xml-xalan/c/src/PlatformSupport/XalanArrayAllocator.hpp line 146:
m_lastEntryFound = &*m_list.begin(); // Dereferenceable bug if m_list.empty()
line 146 shoud be replaced with code
/////////////////////////////////////
if(!m_list.empty())
  m_lastEntryFound = &*m_list.begin();
else
 m_lastEntryFound=0;
/////////////////////////////////////

When I build xalan-c with STLPort debug facilities 
(_STLP_DEBUG,_STLP_DEBUG_ALLOC See http://www.stlport.org/doc/debug_mode.html )

STLPort detects _Dereferenceable(*this) problem in XalanArrayAllocator.hpp:146

Call Stack:
_NMSG_WRITE(int 10) line 221
abort() line 44 + 7 bytes
_STL::__stl_debug_engine<bool>::_Terminate() line 324
_STL::__stl_debug_engine<bool>::_Assert(const char * 0x009af76c `string', const 
char * 0x009af788 `string', int 251) line 308
_STL::_DBG_iter<_STL::__list<_STL::pair<unsigned int,_STL::vector<void const *,
_STL::allocator<void const *> > >,_STL::allocator<_STL::pair<unsigned int,_STL::
vector<void const *,_STL::allocator<void const *> > > > >,_STL::
_Nonconst_traits<_STL::pf75c26d7() line 251 + 67 bytes
xalanc_1_5::XalanArrayAllocator<void const *>::reset() line 146 + 33 bytes
xalanc_1_5::StylesheetConstructionContextDefault::reset() line 352
xalanc_1_5::StylesheetConstructionContextDefault::
~StylesheetConstructionContextDefault() line 160
xalanc_1_5::XalanCompiledStylesheetDefault::~XalanCompiledStylesheetDefault() 
line 152 + 11 bytes
xalanc_1_5::XalanCompiledStylesheetDefault::`vector deleting 
destructor'(unsigned int 1) + 91 bytes
xalanc_1_5::XalanTransformer::destroyStylesheet(const xalanc_1_5::
XalanCompiledStylesheet * 0x012a4bb8) line 664 + 32 bytes
test2() line 46 + 21 bytes
main() line 63
mainCRTStartup() line 338 + 17 bytes
KERNEL32! 77e9ca90()

CODE:
////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <sstream>

#include <Include/PlatformDefinitions.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <XalanTransformer/XalanTransformer.hpp>

  void test2(void){
  
  using namespace std;
  using namespace xalanc;
  using namespace xercesc;
  XalanTransformer xalan_transformer;    

  string xml_body="<?xml version='1.0' encoding='utf-8'?>\n<TEST></TEST>";

  string xsl_body="<?xml version='1.0' encoding='utf-8'?>\n\
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>\
<xsl:output method='xml' encoding='windows-1251'/>\
  <xsl:template match='/'>\
  <xsl:value-of select='/NO_NODE'/>\
  </xsl:template>\
</xsl:stylesheet>";

   try{

      const XalanParsedSource* source = 0;    
      const XalanCompiledStylesheet*    xsl_tr = 0;

      istringstream ixml(xml_body.c_str(),xml_body.length());
      
      if( xalan_transformer.parseSource(ixml,source) )
          throw 1;

      
      
      istringstream ist(xsl_body.c_str(),xsl_body.length());
      if( xalan_transformer.compileStylesheet(ist, xsl_tr) )
        throw 2;
                       
      ostringstream xsl_out;
      if (xalan_transformer.transform(*source,xsl_tr,xsl_out) )
        throw 3;
      cout<<xsl_out.str()<<endl;
      
      if ( xalan_transformer.destroyStylesheet(xsl_tr) )
        throw 4;
      if ( xalan_transformer.destroyParsedSource(source) )
        throw 5;
  } catch(int i){
    cerr<<"ErrorCode:"<<i<<endl;
    cerr<<xalan_transformer.getLastError()<<endl;
  }
  }
 
  int main (){
    using namespace xalanc;
    using namespace xercesc;

    XMLPlatformUtils::Initialize();
		XalanTransformer::initialize();
    test2();
    XalanTransformer::terminate();
    XMLPlatformUtils::Terminate();
    return 0;
  }
////////////////////////////////////////////////////////////////////////