Closed
Bug 228542
Opened 21 years ago
Closed 21 years ago
Divide by zero bug in Universal charset detecter
Categories
(Core :: Internationalization, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: vladimir, Assigned: vladimir)
References
Details
(Keywords: fixed-aviary1.0, fixed1.7.5)
Attachments
(2 files)
412 bytes,
patch
|
smontagu
:
review+
roc
:
superreview+
mkaply
:
approval1.7.5+
|
Details | Diff | Splinter Review |
3 bytes,
text/plain
|
Details |
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Opera 7.23 [en]
Build Identifier:
When text chunk have no latin chars we get divide by zero Error
In nsLatin1Prober.cpp Line 193
confidence = mFreqCounter[3]*1.0f / total;
confidence -= mFreqCounter[1]*20.0f/total;
Must be replaced with
if(!total)
confidence = 0.0f;
else{
confidence = mFreqCounter[3]*1.0f / total;
confidence -= mFreqCounter[1]*20.0f/total;
}
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1•21 years ago
|
||
Is there a reproducible crash associated with this, or did you find the bug by
code inspection? I ask only out of curiosity, and I agree that we should fix
this anyway.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Yes and Yes.
I found it while debug universal detector as DLL on little amount of text.
Two bugs (In reply to comment #1)
> Is there a reproducible crash associated with this, or did you find the bug by
> code inspection? I ask only out of curiosity, and I agree that we should fix
> this anyway.
Yes and Yes.
I found it while debug universal detector as DLL on little amount of text.
Two bugs 228545 and 228542 are interrelated.
Attachment #151519 -
Flags: review?(smontagu)
Due to bug 228542 if we have no english chars in file (text chuck)
total will be equal to 0 and confidence = mFreqCounter[3]*1.0f / total;
will crash detector or fill confidence with NaN
Attachment #151519 -
Flags: superreview?(roc)
Comment 5•21 years ago
|
||
Comment on attachment 151519 [details] [diff] [review]
patch
No need for a new patch this time, but in future please make your patches with
diff -pu9
r=smontagu
Attachment #151519 -
Flags: review?(smontagu) → review+
Updated•21 years ago
|
Assignee: smontagu → vladimir
Attachment #151519 -
Flags: superreview?(roc) → superreview+
Attachment #151519 -
Flags: approval1.7.1?
Comment 6•21 years ago
|
||
Comment on attachment 151519 [details] [diff] [review]
patch
a=mkaply for 1.7.1
When this is checked in, please use consistent bracing on the if statement.
thanks
Attachment #151519 -
Flags: approval1.7.1? → approval1.7.1+
mozilla/extensions/universalchardet/src/nsLatin1Prober.cpp 1.3.50.1
Keywords: fixed1.7.1
Comment 10•21 years ago
|
||
The patch appears to have been checked in, but this bug is still not marked
FIXED -- any reason why?
Timeless?
Assignee | ||
Comment 11•21 years ago
|
||
Thanx for mention.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Keywords: fixed-aviary1.0
You need to log in
before you can comment on or make changes to this bug.
Description
•