|View Issue Details [ Jump to Notes ] ||[ Issue History ] [ Print ] |
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000025||CLAM||Module: Core||public||2012-06-06 16:41||2012-06-06 16:41|
|Assigned To||dgarcia|| |
|Product Version||1.5 (current development)|| |
|Target Version||1.5 (current development)||Fixed in Version|| |
|Summary||0000025: Review string position code should be size_t to be 64 bits safe|
|Description||We detected that some variables used to store positons and indexes within std::strings were declared as unsigned or int. While size_t is not defined as int or unsigned anymore in 64bits architectures. So, in those case we should use size_t instead of int or unsigned.|
|Steps To Reproduce||Besides potential but inlikely problems when dealing with big strings, this leads to inmediate trouble when storing and comparing with npos in code like:|
unsigned pos = s.rfind(....)
if (pos==std::string::npos) .....
Having size_t more precision the first line will truncate the number and the second one will convert it again to size_t rendering into a different value.
|Tags||No tags attached.|