Closed Bug 1228314 Opened 9 years ago Closed 9 years ago

[Static Analysis][INT Overflow] Function LookupBestMatch from SurfaceCache.cpp overflow on idealArea

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox45 --- affected
firefox46 --- fixed
firefox47 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1340239)

Attachments

(2 files)

The Static Analysis tool Scan-Build added that variable idealArea will be assigned a potentially overflow value from int32.
Attached patch Bug 1228314.diffSplinter Review
Hello Seth could you please take a look other this issue and tell me if the patch seems ok?
Flags: needinfo?(seth)
Whiteboard: CID 1340239
A correction to my first post the error was generated by Coverity not Scan-build
Flags: needinfo?(seth)
Attachment #8709049 - Flags: review?(netzen)
Comment on attachment 8709049 [details] MozReview Request: Bug 1228314 - added static_cast<int64> in order to avoid overflow. r?seth Sorry, I am not ideal for this review.
Attachment #8709049 - Flags: review?(netzen)
Attachment #8709049 - Flags: review?(seth) → review+
Comment on attachment 8709049 [details] MozReview Request: Bug 1228314 - added static_cast<int64> in order to avoid overflow. r?seth https://reviewboard.mozilla.org/r/31241/#review33283 Looks good! Thanks for identifying this issue. ::: image/SurfaceCache.cpp:330 (Diff revision 1) > - int64_t idealArea = idealKey.Size().width * idealKey.Size().height; > + int64_t idealArea = static_cast<int64_t>(idealKey.Size().width) * static_cast<int64_t>(idealKey.Size().height); This looks over 80 columns. Please insert a line break right after the '*'.
Comment on attachment 8709049 [details] MozReview Request: Bug 1228314 - added static_cast<int64> in order to avoid overflow. r?seth Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31241/diff/1-2/
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Depends on: 1251742
Comment on attachment 8709049 [details] MozReview Request: Bug 1228314 - added static_cast<int64> in order to avoid overflow. r?seth 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 #8709049 - Flags: approval-mozilla-aurora?
Comment on attachment 8709049 [details] MozReview Request: Bug 1228314 - added static_cast<int64> in order to avoid overflow. r?seth We need this for the other related fixes for surface issues Please uplift to aurora.
Attachment #8709049 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: