Menu

#7 OOB ex. on VS2005 OracleX and stl containers

v1.0 (example)
open
nobody
None
5
2006-10-25
2006-10-25
Anonymous
No

My email:sigbjorn.helset@powel.no

version:otlv4.h 4.140
VS2005,Oracle X,

When invoking a procedure that returns a vector
output parameter, like:
packageX.procedureX( :paramX<int,out[500]> )

you get an out of bounds exception from stl,
std::vector(), if the size of the returned vector is
0 rows.

This is due to the constructs on line 7868.. of type:

case otl_var_int:
memcpy(
OTL_RCAST(char*,
&(*OTL_RCAST(STD_NAMESPACE_PREFIX
vector<int>*,vec.p_v))[0]),
OTL_RCAST(char*,in_vl[cur_in_x]->val()),
sizeof(int)*tmp_len);

if tmp_len is 0, then the underlying vector<Type>
have the size()==0, thus the new stl version in
VS2005 will generate an out of bounds exeption when
trying to do &xxx[0].

The solution is to prefix memcpy with
if(tmp_len)
to avoid using invalid index.
It worked nice for my applications.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB