Closed Bug 40076 Opened 25 years ago Closed 23 years ago

fix signed vs unsigned comparison in nsXMLMIMEDataSource.cpp

Categories

(Core :: Networking, defect, P3)

defect

Tracking

()

VERIFIED FIXED
Future

People

(Reporter: daa, Assigned: gordon)

Details

(Whiteboard: fix in hand[nsbeta3-][next version])

cvs blamed listing 352 davidm 1.6 PRUint32 count; 353 davidm 1.1 rv = info->GetFileExtensions(& count, &extensions ); 354 if ( NS_FAILED ( rv ) ) 355 return rv; 356 buffer+=kExtensions; 357 buffer+="=\""; 358 for ( PRInt32 i = 0; i<(count-1); i++ ) patch: diff -u -r1.11 nsXMLMIMEDataSource.cpp --- nsXMLMIMEDataSource.cpp 2000/05/17 00:05:52 1.11 +++ nsXMLMIMEDataSource.cpp 2000/05/22 01:24:40 @@ -355,7 +355,7 @@ return rv; buffer+=kExtensions; buffer+="=\""; - for ( PRInt32 i = 0; i<(count-1); i++ ) + for ( PRUInt32 i = 0; i<(count-1); i++ ) { buffer+=extensions[i]; buffer+=",";
Can count be 0? Probably be better to convert count to a signed integer. M20
Status: NEW → ASSIGNED
Summary: fix signed vs unsigned comparison in nsXMLMIMEDataSource.cpp → fix signed vs unsigned comparison in nsXMLMIMEDataSource.cpp
Target Milestone: --- → M20
since extensions[] can't have a negitive subscript PRUint32 makes more sense to me
Sure but then you can't do the -1 math since (0-1) is a really big number. Unsigned really doesn't prevent negative numbers. It just converts negative numbers into really big postive ones which almost never what you want. See Lare Scale c++ for why they are so evil in interfaces.
David has left netscape and davidm@netscape.com is an invalid email address. Assigning his five remaining bugs to gagan to find a new owner for them. Thanks
oops i didn't actually reassign to gagan last time. sorry for the spam
Assignee: davidm → gagan
Status: ASSIGNED → NEW
->gordon
Assignee: gagan → gordon
Keywords: nsbeta3
Whiteboard: fix in hand
triage team: nsbeta3- because we don't think we run into this very often. Marking [next version] to indicate that we will check this in for next version, just didn't make this train (bigger fish to fry).
Whiteboard: fix in hand → fix in hand[nsbeta3-][next version]
Target Milestone: M20 → Future
mass move, v2. qa to me.
QA Contact: tever → benc
It looks like this was fixed back in February, 2002, by bzbarasky@mit.edu as part of bug 68801.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.