Use fallible allocations in some places in our font/text shaping code

RESOLVED FIXED in mozilla30

Status

()

Core
Graphics
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Ehsan, Assigned: Ehsan)

Tracking

unspecified
mozilla30
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
It seems like the sizes for these data structures can be controlled from
Web content, and we are already prepared to deal with OOM conditions,
except that we are using infallible allocations by mistake.
(Assignee)

Comment 1

5 years ago
Created attachment 8372837 [details] [diff] [review]
Use fallible allocations in some places in our font/text shaping code
(Assignee)

Updated

5 years ago
Assignee: nobody → ehsan
Blocks: 969864
(Assignee)

Comment 2

5 years ago
Created attachment 8372838 [details] [diff] [review]
Use fallible allocations in some places in our font/text shaping code; r=jfkthame

It seems like the sizes for these data structures can be controlled from
Web content, and we are already prepared to deal with OOM conditions,
except that we are using infallible allocations by mistake.
(Assignee)

Updated

5 years ago
Attachment #8372837 - Attachment is obsolete: true
(Assignee)

Updated

5 years ago
Attachment #8372838 - Flags: review?(jfkthame)
Comment on attachment 8372838 [details] [diff] [review]
Use fallible allocations in some places in our font/text shaping code; r=jfkthame

Review of attachment 8372838 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM, thanks. (I expect some of this code predates the move to infallible-by-default, and just never got updated...)
Attachment #8372838 - Flags: review?(jfkthame) → review+
(Assignee)

Comment 4

5 years ago
(In reply to Jonathan Kew (:jfkthame) from comment #3)
> Comment on attachment 8372838 [details] [diff] [review]
> Use fallible allocations in some places in our font/text shaping code;
> r=jfkthame
> 
> Review of attachment 8372838 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> LGTM, thanks. (I expect some of this code predates the move to
> infallible-by-default, and just never got updated...)

Yeah that's very plausible.  This is a footgun which I'm fixing in bug 969864.  That will convert patterns such as:

  nsTArray<Foo> foos;
  if (!foos.SetLength(AskContentToCrashUs())) {
    // pretend we're handling OOMs here!
  }

not compile, which is how I found this.  :-)
https://hg.mozilla.org/mozilla-central/rev/d4f859c2f0e0
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.