Closed Bug 2064294 Opened 3 months ago Closed 3 months ago

MIME stream converter should use safer methods for parsing and creating URL parameters

Categories

(MailNews Core :: MIME, task)

task

Tracking

(Not tracked)

RESOLVED FIXED
156 Branch

People

(Reporter: darktrojan, Assigned: darktrojan)

References

Details

Attachments

(2 external files)

The stream converter code uses URL parameters to tell it what to do, e.g. if the URL contains part=1.2, only part 1.2 should be returned. But this code uses simple string manipulation for detecting parameters (and for creating new URLs with parameters), and this is a source of bugs. Generally the bugs haven't mattered as these URLs are used only internally (and other bugs can counteract the effects), but as we start to look at this stuff from different angles (e.g. changing how the message display works, bug 2044090) they can come to the surface.

We should be using established code for manipulating URLs, as it's less likely to make mistakes.

For such an important part of our product, nsStreamConverter has barely any direct testing.
This test is a framework for testing it, and we can add tests to cover more code paths in future.

Target Milestone: --- → 156 Branch

This stack conflicts with other patches from the queue (namely bug 1955042 and bug 2061087). I attempted to fix the conflicts, but I wasn't confident enough I was handling the mimemrel.cpp include changes from bug 2061087 and D319387 correctly, so I'll let you rebase once I've pushed the rest of the queue - sorry about that.

Pushed by toby@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/e131c044a688
Add a unit test for the stream converter. r=mkmelin
https://hg.mozilla.org/comm-central/rev/856577ada32f
Use URLParams for parsing and manipulating URL parameters. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
See Also: → 2066293
See Also: → 2066300
See Also: → 2070047
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: