You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Alain Le Guennec (JIRA)" <xa...@xml.apache.org> on 2005/01/27 00:19:52 UTC
[jira] Created: (XALANC-455) Problem when releasing InputSource obtained through an EntityResolver
Problem when releasing InputSource obtained through an EntityResolver
---------------------------------------------------------------------
Key: XALANC-455
URL: http://issues.apache.org/jira/browse/XALANC-455
Project: XalanC
Type: Bug
Components: XalanC
Versions: CurrentCVS, 1.9
Environment: MSVC6 / Win2k
Reporter: Alain Le Guennec
I think there is a problem when cleaning-up InputSources returned by a call to resolveEntity() on an EntityResolver.
The problem lies in routine XSLTEngineImpl::parseXML(), at line 652 of file XSLTEngineImpl.cpp:
A smart pointer of kind XalanMemMgrAutoPtr is used to manage the pointer to the InputSource obtained from the EntityResolver.
However, Xerces' class InputSource inherits from XMemory, and this causes trouble when the XalanMemMgrAutoPtr tries to free the memory.
Indeed, XMemory has customized new() and delete() operators that,
in addition to the space required to hold the object,
also allocates a little space for a special "header" placed just before.
The pointer returned by new() points just after the header, not at the beginning of the allocated area.
In turn, XalanMemMgrAutoPtr calls the memory manager to deallocate the InputSource,
but is not aware of the special header of XMemory objects, and so pass the wrong address to delete()...
On my Windows machine, this systematically results in a bad memory access exception.
I think this problem could also be the cause of the memory leak observed by someone else on this list
(see thread "Changes, bugs, etc. between 1.8 and 1.9").
I guess some system allocators are just stricter than others when delete() is given the wrong address.
I am not too sure how to best fix this problem.
I just replace the use of XalanMemMgrAutoPtr by a simple XalanAutoPtr at line 652, and I don't have any problem anymore.
Maybe it could also be possible to define a template specialization for XalanMemMgrAutoPtr for type XMemory to account for the "header"?
Best regards,
Alain Le Guennec.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANC-455) Problem when releasing InputSource obtained through an EntityResolver
Posted by "Alain Le Guennec (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANC-455?page=comments#action_12318121 ]
Alain Le Guennec commented on XALANC-455:
-----------------------------------------
Apparently, a similar problem exists in file XSLTProcessorEnvSupportDefault.cpp, line 172.
There too, XalanMemMgrAutoPtr should be replaced by XalanAutoPtr.
> Problem when releasing InputSource obtained through an EntityResolver
> ---------------------------------------------------------------------
>
> Key: XALANC-455
> URL: http://issues.apache.org/jira/browse/XALANC-455
> Project: XalanC
> Type: Bug
> Components: XalanC
> Versions: CurrentCVS, 1.9
> Environment: MSVC6 / Win2k
> Reporter: Alain Le Guennec
> Fix For: CurrentCVS
>
> I think there is a problem when cleaning-up InputSources returned by a call to resolveEntity() on an EntityResolver.
> The problem lies in routine XSLTEngineImpl::parseXML(), at line 652 of file XSLTEngineImpl.cpp:
> A smart pointer of kind XalanMemMgrAutoPtr is used to manage the pointer to the InputSource obtained from the EntityResolver.
> However, Xerces' class InputSource inherits from XMemory, and this causes trouble when the XalanMemMgrAutoPtr tries to free the memory.
> Indeed, XMemory has customized new() and delete() operators that,
> in addition to the space required to hold the object,
> also allocates a little space for a special "header" placed just before.
> The pointer returned by new() points just after the header, not at the beginning of the allocated area.
> In turn, XalanMemMgrAutoPtr calls the memory manager to deallocate the InputSource,
> but is not aware of the special header of XMemory objects, and so pass the wrong address to delete()...
> On my Windows machine, this systematically results in a bad memory access exception.
> I think this problem could also be the cause of the memory leak observed by someone else on this list
> (see thread "Changes, bugs, etc. between 1.8 and 1.9").
> I guess some system allocators are just stricter than others when delete() is given the wrong address.
> I am not too sure how to best fix this problem.
> I just replace the use of XalanMemMgrAutoPtr by a simple XalanAutoPtr at line 652, and I don't have any problem anymore.
> Maybe it could also be possible to define a template specialization for XalanMemMgrAutoPtr for type XMemory to account for the "header"?
> Best regards,
> Alain Le Guennec.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANC-455) Problem when releasing InputSource obtained through an EntityResolver
Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANC-455?page=comments#action_58121 ]
David Bertoni commented on XALANC-455:
--------------------------------------
Yes, this is certainly a bug. We should not use XalanMemMgrAutoPtr unless we allocated and created the memory ourselves. XalanAutoPtr is the correct class for this case. I will put a fix in CVS.
Thanks for the report!
> Problem when releasing InputSource obtained through an EntityResolver
> ---------------------------------------------------------------------
>
> Key: XALANC-455
> URL: http://issues.apache.org/jira/browse/XALANC-455
> Project: XalanC
> Type: Bug
> Components: XalanC
> Versions: CurrentCVS, 1.9
> Environment: MSVC6 / Win2k
> Reporter: Alain Le Guennec
>
> I think there is a problem when cleaning-up InputSources returned by a call to resolveEntity() on an EntityResolver.
> The problem lies in routine XSLTEngineImpl::parseXML(), at line 652 of file XSLTEngineImpl.cpp:
> A smart pointer of kind XalanMemMgrAutoPtr is used to manage the pointer to the InputSource obtained from the EntityResolver.
> However, Xerces' class InputSource inherits from XMemory, and this causes trouble when the XalanMemMgrAutoPtr tries to free the memory.
> Indeed, XMemory has customized new() and delete() operators that,
> in addition to the space required to hold the object,
> also allocates a little space for a special "header" placed just before.
> The pointer returned by new() points just after the header, not at the beginning of the allocated area.
> In turn, XalanMemMgrAutoPtr calls the memory manager to deallocate the InputSource,
> but is not aware of the special header of XMemory objects, and so pass the wrong address to delete()...
> On my Windows machine, this systematically results in a bad memory access exception.
> I think this problem could also be the cause of the memory leak observed by someone else on this list
> (see thread "Changes, bugs, etc. between 1.8 and 1.9").
> I guess some system allocators are just stricter than others when delete() is given the wrong address.
> I am not too sure how to best fix this problem.
> I just replace the use of XalanMemMgrAutoPtr by a simple XalanAutoPtr at line 652, and I don't have any problem anymore.
> Maybe it could also be possible to define a template specialization for XalanMemMgrAutoPtr for type XMemory to account for the "header"?
> Best regards,
> Alain Le Guennec.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Resolved: (XALANC-455) Problem when releasing InputSource obtained through an EntityResolver
Posted by "Dmitry Hayes (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANC-455?page=history ]
Dmitry Hayes resolved XALANC-455:
---------------------------------
Resolution: Fixed
Fix Version: CurrentCVS
Fixed. Please review. Thanks!
> Problem when releasing InputSource obtained through an EntityResolver
> ---------------------------------------------------------------------
>
> Key: XALANC-455
> URL: http://issues.apache.org/jira/browse/XALANC-455
> Project: XalanC
> Type: Bug
> Components: XalanC
> Versions: CurrentCVS, 1.9
> Environment: MSVC6 / Win2k
> Reporter: Alain Le Guennec
> Fix For: CurrentCVS
>
> I think there is a problem when cleaning-up InputSources returned by a call to resolveEntity() on an EntityResolver.
> The problem lies in routine XSLTEngineImpl::parseXML(), at line 652 of file XSLTEngineImpl.cpp:
> A smart pointer of kind XalanMemMgrAutoPtr is used to manage the pointer to the InputSource obtained from the EntityResolver.
> However, Xerces' class InputSource inherits from XMemory, and this causes trouble when the XalanMemMgrAutoPtr tries to free the memory.
> Indeed, XMemory has customized new() and delete() operators that,
> in addition to the space required to hold the object,
> also allocates a little space for a special "header" placed just before.
> The pointer returned by new() points just after the header, not at the beginning of the allocated area.
> In turn, XalanMemMgrAutoPtr calls the memory manager to deallocate the InputSource,
> but is not aware of the special header of XMemory objects, and so pass the wrong address to delete()...
> On my Windows machine, this systematically results in a bad memory access exception.
> I think this problem could also be the cause of the memory leak observed by someone else on this list
> (see thread "Changes, bugs, etc. between 1.8 and 1.9").
> I guess some system allocators are just stricter than others when delete() is given the wrong address.
> I am not too sure how to best fix this problem.
> I just replace the use of XalanMemMgrAutoPtr by a simple XalanAutoPtr at line 652, and I don't have any problem anymore.
> Maybe it could also be possible to define a template specialization for XalanMemMgrAutoPtr for type XMemory to account for the "header"?
> Best regards,
> Alain Le Guennec.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANC-455) Problem when releasing InputSource obtained through an EntityResolver
Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANC-455?page=comments#action_12318185 ]
David Bertoni commented on XALANC-455:
--------------------------------------
I have committed a fix for XSLTProcessorEnvSupportDefault.cpp. Thanks for the report!
> Problem when releasing InputSource obtained through an EntityResolver
> ---------------------------------------------------------------------
>
> Key: XALANC-455
> URL: http://issues.apache.org/jira/browse/XALANC-455
> Project: XalanC
> Type: Bug
> Components: XalanC
> Versions: CurrentCVS, 1.9
> Environment: MSVC6 / Win2k
> Reporter: Alain Le Guennec
> Fix For: CurrentCVS
>
> I think there is a problem when cleaning-up InputSources returned by a call to resolveEntity() on an EntityResolver.
> The problem lies in routine XSLTEngineImpl::parseXML(), at line 652 of file XSLTEngineImpl.cpp:
> A smart pointer of kind XalanMemMgrAutoPtr is used to manage the pointer to the InputSource obtained from the EntityResolver.
> However, Xerces' class InputSource inherits from XMemory, and this causes trouble when the XalanMemMgrAutoPtr tries to free the memory.
> Indeed, XMemory has customized new() and delete() operators that,
> in addition to the space required to hold the object,
> also allocates a little space for a special "header" placed just before.
> The pointer returned by new() points just after the header, not at the beginning of the allocated area.
> In turn, XalanMemMgrAutoPtr calls the memory manager to deallocate the InputSource,
> but is not aware of the special header of XMemory objects, and so pass the wrong address to delete()...
> On my Windows machine, this systematically results in a bad memory access exception.
> I think this problem could also be the cause of the memory leak observed by someone else on this list
> (see thread "Changes, bugs, etc. between 1.8 and 1.9").
> I guess some system allocators are just stricter than others when delete() is given the wrong address.
> I am not too sure how to best fix this problem.
> I just replace the use of XalanMemMgrAutoPtr by a simple XalanAutoPtr at line 652, and I don't have any problem anymore.
> Maybe it could also be possible to define a template specialization for XalanMemMgrAutoPtr for type XMemory to account for the "header"?
> Best regards,
> Alain Le Guennec.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org