Closed Bug 1954306 Opened 7 months ago Closed 7 months ago

Crash in [@ strlen | nsCharTraits<T>::length] via nsParseMailMessageState::FinalizeHeaders

Categories

(Thunderbird :: General, defect)

Thunderbird 128
Unspecified
Windows 10
defect

Tracking

(thunderbird_esr128+ affected, thunderbird136- wontfix, thunderbird137+ wontfix)

VERIFIED FIXED
138 Branch
Tracking Status
thunderbird_esr128 + affected
thunderbird136 - wontfix
thunderbird137 + wontfix

People

(Reporter: wsmwk, Assigned: welpy-cw, NeedInfo)

References

Details

(Keywords: crash)

Crash Data

Attachments

(1 file)

#4 crash for 136.0

Crash report: https://crash-stats.mozilla.org/report/index/1db2a371-d21f-4f9e-ba62-351d60250315

Reason:

EXCEPTION_ACCESS_VIOLATION_READ

Top 10 frames:

0  ucrtbase.dll  strlen
1  xul.dll  nsCharTraits<char>::length(char const*)  xpcom/string/nsCharTraits.h:425
1  xul.dll  nsTSubstring<char>::Assign(char const*, unsigned long long, std::nothrow_t co...  xpcom/string/nsTSubstring.cpp:415
2  xul.dll  nsTSubstring<char>::Assign(char const*, unsigned long long)  xpcom/string/nsTSubstring.cpp:394
3  xul.dll  nsParseMailMessageState::FinalizeHeaders()  mailnews/local/src/nsParseMailbox.cpp:713
4  xul.dll  nsParseMailMessageState::ParseFolderLine(char const*, unsigned int)  mailnews/local/src/nsParseMailbox.cpp:236
5  xul.dll  StoreIndexer::OnDataAvailable(nsIRequest*, nsIInputStream*, unsigned long lon...  mailnews/local/src/StoreIndexer.cpp:181
6  xul.dll  nsInputStreamPump::OnStateTransfer()  netwerk/base/nsInputStreamPump.cpp:585
7  xul.dll  nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*)  netwerk/base/nsInputStreamPump.cpp:412
8  xul.dll  CallbackHolder::CallbackHolder::<lambda_1>::operator()() const  xpcom/io/nsPipe3.cpp:73

Crash report: https://crash-stats.mozilla.org/report/index/40d4339a-5cc9-4ae2-8c37-7d5740250315 128.8.0

Reason:

EXCEPTION_ACCESS_VIOLATION_READ

Top 10 frames:

0  ucrtbase.dll  strlen
1  xul.dll  nsCharTraits<char>::length(char const*)  xpcom/string/nsCharTraits.h:423
1  xul.dll  nsTSubstring<char>::Assign(char const*, unsigned long long, std::nothrow_t co...  xpcom/string/nsTSubstring.cpp:422
2  xul.dll  nsTSubstring<char>::Assign(char const*, unsigned long long)  xpcom/string/nsTSubstring.cpp:401
3  xul.dll  nsParseMailMessageState::FinalizeHeaders()  mailnews/local/src/nsParseMailbox.cpp:1031
4  xul.dll  nsParseMailMessageState::ParseFolderLine(char const*, unsigned int)  mailnews/local/src/nsParseMailbox.cpp:530
5  xul.dll  StoreIndexer::OnDataAvailable(nsIRequest*, nsIInputStream*, unsigned long lon...  mailnews/local/src/StoreIndexer.cpp:181
6  xul.dll  nsInputStreamPump::OnStateTransfer()  netwerk/base/nsInputStreamPump.cpp:585
7  xul.dll  nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*)  netwerk/base/nsInputStreamPump.cpp:412
8  xul.dll  CallbackHolder::CallbackHolder::<lambda_1>::operator()() const  xpcom/io/nsPipe3.cpp:73
Version: Thunderbird 115 → Thunderbird 128
See Also: → 1954381

Apart from the same library function involved in the crash, I don't think this relates in any way to bug 1848264 or bug 1907691. The crash from bug 1954381 however happens in a similar way in nsParseMailMessageState::FinalizeHeaders().

No longer depends on: 1848264, 1907691
Summary: Crash in [@ strlen | nsCharTraits<T>::length] via nsImapServerResponseParser::mailbox and nsImapServerResponseParser::ParseIMAPServerResponse( → Crash in [@ strlen | nsCharTraits<T>::length] via via nsParseMailMessageState::FinalizeHeaders

The crash happens here when a Message-ID: header is encountered that either contains comments or is invalid. So maybe fixing bug 697376 could help.

Depends on: 697376
Summary: Crash in [@ strlen | nsCharTraits<T>::length] via via nsParseMailMessageState::FinalizeHeaders → Crash in [@ strlen | nsCharTraits<T>::length] via nsParseMailMessageState::FinalizeHeaders
Assignee: nobody → h.w.forms
Status: NEW → ASSIGNED

(In reply to Hartmut Welpmann [:welpy-cw] from comment #3)

The crash happens here when a Message-ID: header is encountered that either contains comments or is invalid.

… which means that it is not enclosed in angle brackets, contrary to what should almost always be the case (see also RFC 5322). If the id->value is not correctly null-terminated either, strlen keeps looking for 0 until it reaches a memory location it is not supposed to access. While all HeaderData objects should contain null-terminated strings (and debug builds halt execution otherwise), there may still be some obscure bug in nsParseMailMessageState::ParseHeaders() that causes them not to. As long as at least id->length is set correctly, the suggested patch may fix this exact crash.

Try run

I don't think we'll see any effect until this lands in Beta, so leaving open for now.

Severity: -- → S3
Target Milestone: --- → 138 Branch
No longer depends on: 697376
See Also: → 697376

Probably still better for tracking to close now, and reopen if it didn't work based on beta data.

Keywords: leave-open

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/10f9cfba96d3
Make Message-ID handling in nsParseMailMessageState more robust. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED

No chance of seeing an effect in nightly crash rate - there are none

But perhaps in beta 138, because the past beta crash rate is about one per day

So far, there are no version beta 138 crashes. So when 138 release hits, we should see no crashes there.

With a crash ranking of only ~150, ordinarily this might not be worth uplifting to esr (especially with being close to 140 shipping). But based on stacks [1] this might tie to other decently ranked crashes, so perhaps worthy of uplifting some time 138 is proven, i.e. after 128.10.0.

[1] nsParseMailMessageState::FinalizeHeaders on stack

Status: RESOLVED → VERIFIED

At this point perhaps not worth uplifting this and bug 1954306 to esr128, given the modest crash rate on 128 even when combining other crash signatures.

And we can assess the crash rates of comment 10 after esr140 ships

Flags: needinfo?(vseerror) → needinfo?(corey)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: