Closed Bug 715471 Opened 8 years ago Closed 8 years ago

use fallible allocation for potentially large buffers in nsTextFrameThebes.cpp

Categories

(Core :: Layout: Text and Fonts, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla12

People

(Reporter: jfkthame, Assigned: jfkthame)

Details

Attachments

(1 file)

From bug 703100 comment 57:

We should review the existing buffer allocations in nsTextFrameThebes.cpp, and switch to fallible arrays in some cases where we're allocating space for a potentially huge string of text, and the code include checks for failure - it was clearly written assuming fallible arrays, but we've since changed the default behavior of arrays. The buffer passed to BuildTextRunForFrames, for example, should be allocated fallibly, as should the temporary buffer used when we need to "expand" 8- to 16-bit text. Basically, wherever we're doing "nsAutoTArray<T,BIG_TEXT_NODE_SIZE>", we probably want FallibleAutoTArray.
Assignee: nobody → jfkthame
Attachment #588005 - Flags: review?(roc)
Re-landed without the change to how BuildTextRunForFrames is called (it needs to be able to return null for the textrun without this being treated as failure):
https://hg.mozilla.org/integration/mozilla-inbound/rev/4117cd7064ee
Target Milestone: --- → mozilla12
https://hg.mozilla.org/mozilla-central/rev/4117cd7064ee
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.