Closed Bug 303587 Opened 19 years ago Closed 19 years ago

Bad html entity decode algorithm

Categories

(MailNews Core :: Feed Reader, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: lwchk2001, Assigned: mscott)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

Below is feeditem.js lines 345-350:

  // the subject may contain HTML entities.
  // Convert these to their unencoded state. i.e. & becomes '&'
  title = title.replace(/&lt;/g, '<');
  title = title.replace(/&gt;/g, '>');
  title = title.replace(/&amp;/g, '&');
  title = title.replace(/&quot;/g, '"');

Since & is decoded prior to ", &amp;quot; will be wrongly decoded to " rather
than &quot;

So the code should be modified as follows:

  title = title.replace(/&lt;/g, '<');
  title = title.replace(/&gt;/g, '>');
  title = title.replace(/&quot;/g, '"');
  title = title.replace(/&amp;/g, '&');


Reproducible: Always

Steps to Reproduce:
A similar bug is found on the same source file, lines 199-204. Again, switching
the last two lines fix the bug.

    // HACK ALERT: before we give up, try to work around an entity escaping bug
in RDF
    // See Bug #258465 for more details
    itemURI = itemURI.replace(/&lt;/g, '<');
    itemURI = itemURI.replace(/&gt;/g, '>');
    itemURI = itemURI.replace(/&amp;/g, '&');
    itemURI = itemURI.replace(/&quot;/g, '"');
Attached patch the fix β€” β€” Splinter Review
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird1.1
Component: RSS → Feed Reader
Product: Thunderbird → MailNews Core
Target Milestone: Thunderbird1.1 → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: