Closed
Bug 1251742
Opened 9 years ago
Closed 9 years ago
avoid overflow in computing area of surface sizes in SurfaceCache
Categories
(Core :: Graphics: ImageLib, defect)
Core
Graphics: ImageLib
Tracking
()
RESOLVED
FIXED
mozilla47
People
(Reporter: tnikkel, Assigned: tnikkel)
References
Details
Attachments
(1 file)
1.54 KB,
patch
|
dholbert
:
review+
lizzard
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•9 years ago
|
||
This patch is before the patch for bug 1251091 in my patch queue, so I'll land this patch first.
Attachment #8724244 -
Flags: review?(dholbert)
Comment 2•9 years ago
|
||
Comment on attachment 8724244 [details] [diff] [review] patch Review of attachment 8724244 [details] [diff] [review]: ----------------------------------------------------------------- ::: image/SurfaceCache.cpp @@ +331,5 @@ > static_cast<int64_t>(idealKey.Size().height); > + int64_t surfaceArea = static_cast<int64_t>(aSurfaceKey.Size().width) * > + static_cast<int64_t>(aSurfaceKey.Size().height); > + int64_t bestMatchArea = static_cast<int64_t>(bestMatchKey.Size().width) * > + static_cast<int64_t>(bestMatchKey.Size().height); There's a lot of repetition here (the pattern as a whole is repeated 3 times, and each key.Size() is repeated twice within each instance of the pattern). Makes for slightly-hard reading, and possibility for easy-to-miss mistakes. So, I'd prefer we factored out a trivial helper function, defined right above this method if you like, e.g. static int64_t AreaOfIntSize(IntSize aSize) { ... } Then this could just be: int64_t idealArea = AreaOfIntSize(idealKey.Size()); int64_t surfaceArea = AreaOfIntSize(surfaceKey.Size()); int64_t bestMatchArea = AreaOfIntSize(bestMatchKey.Size()); r=me with that.
Attachment #8724244 -
Flags: review?(dholbert) → review+
Comment 3•9 years ago
|
||
Sorry, I should've had "IntSize& aSize" in the helper-function signature (passing by reference instead of by copy).
Assignee | ||
Comment 5•9 years ago
|
||
I also had to make SurfaceKey::Size return a const IntSize& (instead of IntSize), and AreaOfIntSize take a const IntSize&.
Comment 8•9 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/e4ae782bcc00
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox47:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Assignee | ||
Comment 9•9 years ago
|
||
Comment on attachment 8724244 [details] [diff] [review] patch Need this for bug 1251091. Approval Request Comment [Feature/regressing bug #]: bug 1119774 added this code [User impact if declined]: needed for bug 1251091 [Describe test coverage new/current, TreeHerder]: none [Risks and why]: safe [String/UUID change made/needed]: none
Attachment #8724244 -
Flags: approval-mozilla-aurora?
Comment 10•9 years ago
|
||
Comment on attachment 8724244 [details] [diff] [review] patch More surface cache work, please uplift to aurora. Timothy, hopefully you can keep an eye out for new regressions/crashes in 46 that might be related as we go into early beta.
Attachment #8724244 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 11•9 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-aurora/rev/6b950d8d294c
status-firefox46:
--- → fixed
Comment 12•9 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-aurora/rev/6b950d8d294c
You need to log in
before you can comment on or make changes to this bug.
Description
•