Closed
Bug 1020008
Opened 10 years ago
Closed 10 years ago
Out-of-bounds read in gfxPlatform::GetPrefLangName
Categories
(Core :: Graphics: Text, defect)
Core
Graphics: Text
Tracking
()
People
(Reporter: mccr8, Assigned: jfkthame)
References
(Blocks 1 open bug)
Details
(Keywords: coverity, csectype-bounds, sec-low, Whiteboard: [adv-main31+])
Attachments
(1 file)
(deleted),
patch
|
smontagu
:
review+
Sylvestre
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
Here is code from gfxPlatform::GetPrefLangName:
if (uint32_t(aLang) < uint32_t(eFontPrefLang_AllCount))
return gPrefLangNames[uint32_t(aLang)];
eFontPrefLang_AllCount is 32, whereas gPrefLangNames has 31 entries in it. Thus if you pass in 31, you'll end up reading past the end of gPrefLangNames. Maybe the check should be against eFontPrefLang_LangCount (which is 30) instead of eFontPrefLang_AllCount? Presumably a static assert could catch problems here in the future.
At first I thought this was a regression from bug 213517, but it looks like that _removed_ an entry from eFontPrefLang, so I think it made it slightly better. I did a bit of digging, but I'm not sure when this was introduced. Coverity first noticed this in December 2012.
Assignee | ||
Comment 1•10 years ago
|
||
Looks to me like the simple solution here is to scrap the enum constants for the count of lang names, and just use ArraySize when referring to the array of strings.
Attachment #8433999 -
Flags: review?(smontagu)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Comment 2•10 years ago
|
||
Comment on attachment 8433999 [details] [diff] [review]
use mozilla::ArrayLength for array size.
Review of attachment 8433999 [details] [diff] [review]:
-----------------------------------------------------------------
Makes sense
Attachment #8433999 -
Flags: review?(smontagu) → review+
Assignee | ||
Comment 3•10 years ago
|
||
Target Milestone: --- → mozilla32
https://hg.mozilla.org/mozilla-central/rev/cbb2e610473e
Should this go to Aurora or anything?
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox32:
--- → fixed
Flags: needinfo?(jfkthame)
Resolution: --- → FIXED
Assignee | ||
Comment 5•10 years ago
|
||
(In reply to Wes Kocher (:KWierso) from comment #4)
> https://hg.mozilla.org/mozilla-central/rev/cbb2e610473e
>
> Should this go to Aurora or anything?
There's no compelling need for it to do so IMO. We may sometimes read an out-of-bounds value, but we don't do anything dangerous with it, AFAICS.
Flags: needinfo?(jfkthame)
Comment 6•10 years ago
|
||
The next ESR is FF31 so does that make a more compelling case for uplifting this?
Flags: needinfo?(jfkthame)
Updated•10 years ago
|
status-firefox-esr24:
--- → wontfix
Assignee | ||
Comment 7•10 years ago
|
||
Any security risk here looks low (AFAICS), but the patch itself is also extremely low risk, so there's no reason -not- to take it.
Flags: needinfo?(jfkthame)
Assignee | ||
Comment 8•10 years ago
|
||
Comment on attachment 8433999 [details] [diff] [review]
use mozilla::ArrayLength for array size.
Nominating for beta (this is currently on aurora) so that it'll go into ESR31. It's minor, but very safe, and nicer for future maintenance if the ESR code is correct and matches trunk code going forward.
Approval Request Comment
[Feature/regressing bug #]: Longstanding flaw, found by coverity analysis rather than observed buggy/crashy behavior.
[User impact if declined]: Probably none; it's not entirely clear to me whether the error here can actually be reached from web content, nor that anything worse than perhaps choosing the wrong font would happen. But -perhaps- in exactly the right conditions, it'd be possible to reach an out-of-bounds read, and crash with a protection violation if the location happens to be unreadable.
[Describe test coverage new/current, TBPL]: There's no directly testable behavior exposed here. (Only if it were thoroughly broken, font-related reftests would start to fail.)
[Risks and why]: Minimal risk, just avoids potentially reading one element too far from a static array and getting junk.
[String/UUID change made/needed]: none
Attachment #8433999 -
Flags: approval-mozilla-beta?
Updated•10 years ago
|
status-firefox31:
--- → affected
status-firefox33:
--- → fixed
Comment 9•10 years ago
|
||
Comment on attachment 8433999 [details] [diff] [review]
use mozilla::ArrayLength for array size.
As Lukas said, 31 is an ESR release. We are going to maintain it for a while.
Attachment #8433999 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
Comment 10•10 years ago
|
||
status-b2g-v1.3:
--- → wontfix
status-b2g-v1.3T:
--- → wontfix
status-b2g-v1.4:
--- → wontfix
status-b2g-v2.0:
--- → fixed
status-firefox30:
--- → wontfix
status-firefox33:
fixed → ---
Updated•10 years ago
|
Whiteboard: [adv-main31+]
Comment 11•10 years ago
|
||
Marking this as [qa-] due to the lack of STR/POC that could be used for verification. If anything can be provided to help test and verify, I'll happily go through it!
QA Whiteboard: [qa-]
Updated•9 years ago
|
Group: core-security → core-security-release
Updated•8 years ago
|
Group: core-security-release
Updated•6 years ago
|
Blocks: coverity-analysis
You need to log in
before you can comment on or make changes to this bug.
Description
•