Closed
Bug 843434
Opened 12 years ago
Closed 12 years ago
Assertion failure in nsUnicharStreamLoader::WriteSegmentFun with ISO-2022-JP
Categories
(Core :: Networking, defect)
Tracking
()
RESOLVED
FIXED
mozilla22
Tracking | Status | |
---|---|---|
firefox20 | - | affected |
firefox21 | + | fixed |
firefox22 | --- | fixed |
firefox-esr17 | --- | unaffected |
b2g18 | --- | unaffected |
People
(Reporter: jruderman, Assigned: jaas)
References
Details
(4 keywords, Whiteboard: [adv-main21+])
Attachments
(4 files, 2 obsolete files)
(deleted),
text/html
|
Details | |
(deleted),
text/plain
|
Details | |
(deleted),
text/html
|
Details | |
(deleted),
patch
|
emk
:
review+
bajaj
:
approval-mozilla-beta+
lsblakk
:
approval-mozilla-release-
|
Details | Diff | Splinter Review |
Assertion failure: ((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1))), at netwerk/base/src/nsUnicharStreamLoader.cpp:218
213 DebugOnly<nsresult> rv =
214 self->mDecoder->Convert(aSegment,
215 &srcLen,
216 self->mBuffer.BeginWriting() + haveRead,
217 &dstLen);
* 218 MOZ_ASSERT(NS_SUCCEEDED(rv));
219 MOZ_ASSERT(srcLen == static_cast<int32_t>(aCount));
220 haveRead += dstLen;
221
222 self->mBuffer.SetLength(haveRead);
Reporter | ||
Comment 1•12 years ago
|
||
Comment 2•12 years ago
|
||
ISO-2022-JP decoder should honor the mErrBehavior...
Comment 3•12 years ago
|
||
is dstLen initialized to something or did line 220-222 just incorporate a random amount of junk into the string?
Keywords: sec-moderate
Comment 4•12 years ago
|
||
dstLen is initialized by GetMaxLength in line 206.
Reporter | ||
Comment 5•12 years ago
|
||
Assertion failure: ((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1))), at ../../../../content/base/src/nsScriptLoader.cpp:1070
(In reply to Masatoshi Kimura [:emk] from comment #2)
> ISO-2022-JP decoder should honor the mErrBehavior...
Can you explain this further?
The error code causing the assertion comes from nsISO2022JPToUnicodeV2::Convert:
================
switch(mState)
{
case mState_ASCII:
if(0x1b == *src)
{
mLastLegalState = mState;
mState = mState_ESC;
} else if(*src & 0x80) {
ERROR-> goto error2;
} else {
if (CHECK_OVERRUN(dest, destEnd, 1))
goto error1;
*dest++ = (PRUnichar) *src;
}
break;
================
The state is mState_ASCII, and "if(*src & 0x80)" is true.
Comment 7•12 years ago
|
||
(In reply to Josh Aas (Mozilla Corporation) from comment #6)
> (In reply to Masatoshi Kimura [:emk] from comment #2)
> > ISO-2022-JP decoder should honor the mErrBehavior...
>
> Can you explain this further?
1. If mErrBehavior is not kOnError_Signal (default), the ISO-2022-JP decoder should replace the offending char with a REPLACEMENT CHARACTER (U+FFFD) rather than throwing NS_ERROR_UNEXPECTED.
2. Even if mErrBehavior is kOnError_Signal, the thrown error should be NS_ERROR_ILLEGAL_INPUT.
Thanks for the info.
This avoids the assertion in the first test case, and gives what I'd expect for an error in the script case. I don't really know what this code is supposed to be doing though, so please review carefully!
Attachment #722639 -
Flags: review?(VYV03354)
Comment 9•12 years ago
|
||
Comment on attachment 722639 [details] [diff] [review]
fix v1.0
You need to call CHECK_OVERRUN every time you write to dest.
Attachment #722639 -
Flags: review?(VYV03354) → review-
Assignee | ||
Comment 10•12 years ago
|
||
Like so?
Attachment #722639 -
Attachment is obsolete: true
Attachment #722911 -
Flags: review?(VYV03354)
Assignee | ||
Comment 11•12 years ago
|
||
I will also write a test for this.
Comment 12•12 years ago
|
||
Comment on attachment 722911 [details] [diff] [review]
fix v1.1
LGTM
Updated•12 years ago
|
Attachment #722911 -
Flags: review?(VYV03354) → review+
Assignee | ||
Comment 13•12 years ago
|
||
This test works, but there may be a better test. The test here fails if the assertion is triggered.
Attachment #722911 -
Attachment is obsolete: true
Attachment #723468 -
Flags: review?(VYV03354)
Updated•12 years ago
|
Attachment #723468 -
Flags: review?(VYV03354) → review+
Assignee | ||
Comment 14•12 years ago
|
||
Attachment #723468 -
Flags: review?(smontagu)
Assignee | ||
Comment 15•12 years ago
|
||
Comment on attachment 723468 [details] [diff] [review]
fix v1.1 w/test
Canceling second review, turns out emk is a peer. Had smontagu update the module owernship wiki.
Attachment #723468 -
Flags: review?(smontagu)
Assignee | ||
Comment 16•12 years ago
|
||
pushed to mozilla-inbound
http://hg.mozilla.org/integration/mozilla-inbound/rev/8d7a31fbb879
Comment 17•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
status-firefox22:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Reporter | ||
Comment 18•12 years ago
|
||
I found another testcase that still trips the assertion. Filed bug 851982.
Comment 19•12 years ago
|
||
Comment on attachment 723468 [details] [diff] [review]
fix v1.1 w/test
[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 638379
User impact if declined: Some Japanese production sites are broken (see bug 858433).
Testing completed (on m-c, etc.): on m-c and aurora
Risk to taking this patch (and alternatives if risky): very low
String or IDL/UUID changes made by this patch: none
Attachment #723468 -
Flags: approval-mozilla-release?
Attachment #723468 -
Flags: approval-mozilla-beta?
Comment 20•12 years ago
|
||
Approving on beta, as this is a recent regression from Bug 638379, which has impacted a few Japanese websites .The patch fixes the broken websites and is low risk,well baked on m-c and aurora.
Please land asap for this to make it into our next beta going to build tomorrow morning PT .
Updated•12 years ago
|
Attachment #723468 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
Updated•12 years ago
|
status-firefox21:
--- → affected
tracking-firefox21:
--- → +
Comment 21•12 years ago
|
||
status-firefox20:
--- → affected
Updated•12 years ago
|
tracking-firefox20:
--- → ?
Comment 22•12 years ago
|
||
Since this is sec-moderate, and we don't have indications that a large number of sites are affected, we'll ship this fix in FF21.
Updated•12 years ago
|
Attachment #723468 -
Flags: approval-mozilla-release? → approval-mozilla-release-
Updated•12 years ago
|
Whiteboard: [adv-main21+]
Updated•12 years ago
|
Blocks: 638379
status-b2g18:
--- → unaffected
status-firefox-esr17:
--- → unaffected
Keywords: regression
Updated•11 years ago
|
Group: core-security
You need to log in
before you can comment on or make changes to this bug.
Description
•