Closed Bug 617913 Opened 14 years ago Closed 14 years ago

FuzzOneInvalidCaseConversion could check result of CaseInsensitiveCompare/CharByCharCompareEqual

Categories

(Core :: Internationalization, defect)

x86
macOS
defect
Not set
trivial

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity)

Attachments

(1 file, 1 obsolete file)

coverity likes to be able to warn when the result of a function is only sometimes checked. typically when its result isn't checked, that's an accidental omission.
Attached patch check function calls (obsolete) — Splinter Review
Assignee: smontagu → timeless
Status: NEW → ASSIGNED
Attachment #496483 - Flags: review?(smontagu)
Attachment #496483 - Flags: approval2.0?
Comment on attachment 496483 [details] [diff] [review] check function calls >- CaseInsensitiveCompare((char*)aBuf, (char*)bBuf, aLen, bLen); >- CharByCharCompareEqual((char*)aBuf, (char*)bBuf, aLen, bLen); >+ if (CaseInsensitiveCompare((char*)aBuf, (char*)bBuf, aLen, bLen)) >+ printf("\tSurprise, two random strings compared insensitively as equal!\n"); Shouldn't this be |if (!CaseInsensitiveCompare...| ? >+ if (CharByCharCompareEqual((char*)aBuf, (char*)bBuf, aLen, bLen)) >+ printf("\tSurprise, two random strings compared as exactly equal!\n");
afaict they return true if strings compare as equal. since both strings are random, that shouldn't happen, so i'm checking for true.
Hmm. Afa*I*ct CaseInsensitiveCompare returns strcmp-style result codes so you should be testing for 0. http://mxr.mozilla.org/mozilla-central/source/intl/unicharutil/util/nsUnicharUtils.cpp#478
Attached patch oh!Splinter Review
right, one's a Compare and one's an Equals, how confusing. thanks.
Attachment #496483 - Attachment is obsolete: true
Attachment #497253 - Flags: review?(smontagu)
Attachment #497253 - Flags: approval2.0?
Attachment #496483 - Flags: review?(smontagu)
Attachment #496483 - Flags: approval2.0?
Attachment #497253 - Flags: review?(smontagu) → review+
Comment on attachment 497253 [details] [diff] [review] oh! Test-only, so approval really isn't needed.
Attachment #497253 - Flags: approval2.0? → approval2.0+
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: