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

766 B

thunderbird-0002 — nsMsgCopyService::DoNextCopy() ContainsObject O(N^2)

UNDF: UNDF-2026-000000888 MOAD: 0001 (CWE-407) Severity: MEDIUM-HIGH Component: mailnews/base/src/nsMsgCopyService.cpp

Summary

DoNextCopy() iterates through m_copyRequests and for each request checks if the destination folder is already in activeTargets using ContainsObject(), which performs a linear scan. As activeTargets grows with each iteration, this creates O(N^2) complexity.

Measured 250x overhead at N=500 copy requests.

Fix

Replace ContainsObject() with a nsTHashSet<nsISupports*> for O(1) membership checks.

Files

  • patch/thunderbird-0002_nsMsgCopyService_DoNextCopy_ContainsObject_ON2.patch
  • test/ThunderbirdCopyServiceTest.java