java-topology/defects/thunderbird-0005/TICKET.md

845 B

thunderbird-0005 — nsMsgFilterList::ComputeArbitraryHeaders() FindInReadable O(H^2)

UNDF: UNDF-2026-000000891 MOAD: 0001 (CWE-407) Severity: MEDIUM Component: mailnews/search/src/nsMsgFilterList.cpp

Summary

ComputeArbitraryHeaders() iterates through all filter terms and for each arbitrary header checks if it is already accumulated in m_arbitraryHeaders using FindInReadable() (substring search). This is O(H^2) where H is the number of unique arbitrary headers across all filters.

Measured 125x overhead at H=500 arbitrary headers.

Fix

Track seen headers in an nsTHashSet<nsCString> during accumulation, then join into our string at the end. Eliminates repeated substring scans.

Files

  • patch/thunderbird-0005_nsMsgFilterList_ComputeArbitraryHeaders_ON2.patch
  • test/ThunderbirdFilterListTest.java