zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #11862
[Bug 1020942] Re: vector subscript out of range assertion hit on windows
** Changed in: zorba
Status: In Progress => Fix Committed
--
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/1020942
Title:
vector subscript out of range assertion hit on windows
Status in Zorba - The XQuery Processor:
Fix Committed
Bug description:
in src/zorbatypes/binary.cpp a lot of vectors are accessed with [0],
e.g.:
aBase64.theData.resize(
copy_without_ws( aString, aLength, &aBase64.theData[0] )
);
if in this case aLength is of size 0 the assertion "vector subscript
out of range" is hit on windows in debug build. This happens because
size == pos in std::vector implementation on windows:
reference operator[](size_type _Pos)
{ // subscript mutable sequence
#if _ITERATOR_DEBUG_LEVEL == 2
if (size() <= _Pos)
{ // report error
_DEBUG_ERROR("vector subscript out of range");
_SCL_SECURE_OUT_OF_RANGE;
}
Therefore, before accessing a vector with [0] one must check whether
the size of the vector is > 0. Otherwise the mentioned assertion will
trigger.
To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/1020942/+subscriptions
References