Two mistakes in the toolbox/../ArrayT.h ?

Two mistakes in the toolbox/../ArrayT.h ?

Postby sander » Mon Dec 08, 2008 4:29 am

In the toolbox Aug 08, V2.1; ArrayT.h:
Line 718, the function ReleasePointer,
" else if (array == NULL) " ,then would call ExceptionT. However, whether the variable "array" here is or is not NULL do not mean anything. I guess the correct one should be " else if (fArray == NULL)".

Line 492 and Line 504, about the extended errorcheck in function Pointer:
"if (offset < 0 || offset > fLength) ", then would call ExceptionT.
As a matter of fact when offset=fLength, the "fArray+offset" has already been pointing to a place out of range. But this error would not be reported until this sentence were "if (offset < 0 || offset >= fLength) ". Naturally , there are some more redundancy error checks here so this probably won't cause one fatal error, but indeed this is a little mistake.

Hope can check these mistakes, and if they really are , correct them in the next vision.
sander
Junior Member
 
Posts: 1
Joined: Tue Sep 02, 2008 1:59 am

Postby paklein » Sat Jun 27, 2009 9:04 am

Hi sander,

In the first case, array cannot be NULL; otherwise, assigning to *array is a problem.

Re: line 492 -- the comments in the code indicate we were aware that you'll be running off the end of the array.

Thanks.
Patrick Klein
Redwood City, CA
paklein
Junior Member
 
Posts: 485
Joined: Tue May 22, 2001 7:42 pm
Location: Redwood City, CA


Return to Tahoe toolbox

Who is online

Users browsing this forum: No registered users and 1 guest

cron