View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000025CLAMModule: Corepublic2012-06-06 16:412012-06-06 16:41
Assigned Todgarcia 
Platformamd64OSUbuntuOS VersionPrecise
Product Version1.5 (current development) 
Target Version1.5 (current development)Fixed in Version 
Summary0000025: Review string position code should be size_t to be 64 bits safe
DescriptionWe 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 ReproduceBesides 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.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2012-06-06 16:41 dgarcia New Issue
2012-06-06 16:41 dgarcia Status new => assigned
2012-06-06 16:41 dgarcia Assigned To => dgarcia

Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker