Mac OS X plugin code does not support non-ASCII characters in plugin name/description

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: jfkthame, Assigned: jfkthame)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Assignee

Description

9 years ago
If there are non-ASCII characters in the name or description of a plugin, these strings will be missing from the information displayed in about:addons.

This can be demonstrated by adding a non-ASCII character to the Description string of the Test Plug-in; when viewing the Plug-ins panel in about:addons, the Description will be entirely missing.

This happens because the function CFStringRefToUTF8Buffer at http://mxr.mozilla.org/mozilla-central/source/modules/plugin/base/src/nsPluginsDirDarwin.cpp#125 assumes that the UTF8 string will contain no more codepoints than the number of (UTF16) characters in the original CFString. This holds *only* for ASCII characters; as soon as a non-ASCII character is present in the string, the buffer will be too small and CFStringGetCString will fail.

Updated

9 years ago
Assignee: nobody → joshmoz
Assignee

Comment 1

9 years ago
This patch allows the nsPluginsDirDarwin.cpp code to read non-ASCII strings successfully.

However, I notice that the string is not correctly displayed in about:addons, so it looks like there's an encoding issue at another level as well.
Attachment #502905 - Flags: review?(joshmoz)

Updated

9 years ago
Assignee: joshmoz → jfkthame
Assignee

Comment 2

9 years ago
The nsPluginsDirDarwin code now returns strings as UTF-8, so we should _not_ apply a further encoding conversion to the bytes in nsPluginTag::EnsureMembersAreUTF8().

Once that is disabled, the non-ASCII plugin info displays correctly in about:plugins.

BTW, I'm working on a test for this in bug 607121 (which is how I first discovered that the Mac code was failing on non-ASCII strings).
Attachment #502905 - Attachment is obsolete: true
Attachment #502923 - Flags: review?(joshmoz)
Attachment #502905 - Flags: review?(joshmoz)

Updated

9 years ago
Attachment #502923 - Flags: review?(joshmoz) → review+
Assignee

Comment 3

9 years ago
Comment on attachment 502923 [details] [diff] [review]
patch, v2 - allow for non-ASCII characters when reading plugin info strings

Requesting approval-2.0; this is needed particularly for i18n reasons, otherwise plugin names or descriptions that happen to include any non-ASCII characters (even just an accented vowel, “curly quotes”, copyright or trademark signs, etc) will completely fail to show up on OS X.

This is also needed in order to be able to create a cross-platform test for bug 607121 (which showed that such characters do indeed get used sometimes, even without considering localization). The OS X failure is actually worse than the Windows failure in that bug, as it causes the string to be dropped completely, not just a single character rendering incorrectly.
Attachment #502923 - Flags: approval2.0?

Updated

9 years ago
Attachment #502923 - Flags: approval2.0? → approval2.0+
Assignee

Comment 4

9 years ago
http://hg.mozilla.org/mozilla-central/rev/616a453859c6
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.