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

783 B

thunderbird-0001 — nsMsgAccountManager::LoadAccounts() O(N^2) duplicate detection

UNDF: UNDF-2026-000000887 MOAD: 0001 (CWE-407) Severity: MEDIUM Component: mailnews/base/src/nsMsgAccountManager.cpp

Summary

LoadAccounts() uses IndexOf() inside a loop for duplicate account detection, producing O(N^2) complexity. RemoveAccount() and GetAllIdentities() have the same pattern with nested loops over identity lists.

Measured 250x overhead at N=500 accounts. Runs on every Thunderbird startup.

Fix

Replace IndexOf() dedup with nsTHashSet<nsCString> for O(1) membership checks, reducing overall complexity to O(N).

Files

  • patch/thunderbird-0001_nsMsgAccountManager_LoadAccounts_indexOf_ON2.patch
  • test/ThunderbirdAccountManagerTest.java