Closed Bug 1902020 Opened 14 days ago Closed 5 days ago

Single file archive base64 content length isn't being properly calculated in some cases

Categories

(Firefox :: Profile Backup, defect, P3)

defect

Tracking

()

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: mconley, Assigned: mconley)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fidefe-device-migration])

Attachments

(1 file)

After bug 1897498 landed, I tried to export the simple single-file archive with my main profile. This worked properly, but when attempting to extract the ZIP file, the extraction routine choked on the base64 bytes being pulled in. When I debugged this, it looks like what's going on is that the base64 string being decoded is being truncated a bit - and this is likely because we computed an incorrect content length for the base64 bytes.

This bug is for getting that fixed and a proper test written for this case.

I found the bug. We're erroneously assuming that the number of base64 encoded bytes for some bytes X is equal to the sum of the base64 encoded bytes for some bytes X / N, where N is some chunk size.

When bytes are divided like this into chunks, if the chunk is not a multiple of 6, base64 encoding will add some padding. We need to take that individual chunk padding into account.

Assignee: nobody → mconley
Status: NEW → ASSIGNED
Pushed by mconley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/45f7948e5eeb
Fix a math error in calculating binary blob content length when it divides evenly by chunk size. r=backup-reviewers,fchasen
Status: ASSIGNED → RESOLVED
Closed: 5 days ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: