[
http://issues.apache.org/jira/browse/XALANC-583?page=comments#action_12357446 ]
Soren Soe commented on XALANC-583:
----------------------------------
% uname -a
SunOS champ 5.8 Generic_108528-09 sun4u sparc SUNW,Ultra-5_10
% CC -V
CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-18 2003/09/24
with
STLPort-4.5
I configured Xalan using the runConfigure script with a few environment
variables pointing to my version of STLPort. In order for Xalan to even
compile, I had to manually set -DXALAN_HAS_STD_ITERATORS. I was able to
successfully build and link Xalan, but running any of the test programs
immediately resulted in Abort. I traced this to local_distance in
XalanVector.hpp, where I noticed the uninitialized variable. Initializing
'theDistance' to size_type(0) fixed the runtime problems. After this, I
realized that I should probably have compiled with -DXALAN_HAS_STD_DISTANCE.
Basically, I am set, but I thought you might want to just fix the
uninitialized variable.
Here is the STL code I think is executed from local_distance, when compiling
without -DXALAN_HAS_STD_DISTANCE:
template < class _RandomAccessIterator , class _Distance >
inline void __distance ( const _RandomAccessIterator & __first ,
const _RandomAccessIterator & __last ,
_Distance & __n , const random_access_iterator_tag & ) {
__n += __last - __first ;
}
Thanks,
Soren.
> XalanVector.hpp is missing initialiation of local variable
> ----------------------------------------------------------
>
> Key: XALANC-583
> URL: http://issues.apache.org/jira/browse/XALANC-583
> Project: XalanC
> Type: Bug
> Components: XalanC
> Versions: 1.10
> Environment: N/A
> Reporter: Soren Soe
>
> The member function 'local_distance' declares 'size_type theDistance' but
> does not initialize the variable. The variable is passed to
> std::distance(itr,itr,distance), where its value is referenced and used in a
> '+=' expression. Failing to initialize 'theDistance' causes
> 'local_distance' to have undefined behavior, ultimately leading to a crash at
> runtime.
--
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]