Closed Bug 2046883 Opened 5 months ago Closed 5 months ago

OpenPGP keyRing.sys.mjs has incorrect implementation for getCacheEmpty()

Categories

(MailNews Core :: Security: OpenPGP, defect)

defect

Tracking

(Not tracked)

RESOLVED FIXED
153 Branch

People

(Reporter: KaiE, Assigned: KaiE)

References

Details

(Keywords: ai-involved)

Attachments

(1 external file)

Claude code helped me identify this during a code review.

keyring.sys.mjs declares
let gKeyIndex = [];

but uses
gKeyIndex.length === 0;

to check for empyness.

This isn't guaranteed to work because this code returns also zero:

let gMyArr = [];
gMyArr["a1234567"] = {};
gMyArr["b2345678"] = {};
gMyArr["c3456789"] = {};
gMyArr.length;

Blocks: 2011199
Assignee: nobody → kaie
Status: NEW → ASSIGNED

Pushed by corey@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/336ee1192b91
Use Map not [] in keyRing.sys for gKeyIndex and gSubkeyIndex. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: