746 B
746 B
thunderbird-0003 — nsAutoSyncManager IndexOf O(N^2) IMAP folder queue ops
UNDF: UNDF-2026-000000889 MOAD: 0001 (CWE-407) Severity: HIGH Component: mailnews/imap/src/nsAutoSyncManager.cpp
Summary
IMAP auto-sync manager maintains priority queues of folders to sync. Multiple
methods use IndexOf() inside loops:
ChainFoldersInQ()— nested loops O(N^2)AutoUpdateFolders()— IndexOf for dedup O(N^2)OnDownloadCompleted()— IndexOf for position lookup O(N^2)
Measured 250x overhead at N=500 folders.
Fix
Replace IndexOf() calls with nsTHashSet or position maps for O(1) lookup.
Files
- patch/thunderbird-0003_nsAutoSyncManager_IndexOf_ON2.patch
- test/ThunderbirdAutoSyncManagerTest.java