Closed Bug 1238777 Opened 10 years ago Closed 10 years ago

Make ComputeSnappedImageDrawingParameters more robust against 0-sized source image regions

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(1 file)

(This is a followup to bug 1224736) As discussed in bug 1224736 comment 35, if we can get ourselves to attempt to draw a 0-sized RasterImage into a nonzero-sized destination area, then ComputeSnappedImageDrawingParameters produces a bogus transform (with NaN scale factors) and we end up busting our internal graphics state, and breaking subsequent perfectly-good drawing commands with errors like: [GFX2-]: DrawTargetCairo context in error state: invalid matrix (not invertible)(5) [GFX2-]: ASurface Init failed with Cairo status 1 on 0x0x7ff5dd6e95b8 We should make ComputeSnappedImageDrawingParameters handle this sort of breakage more graceful (refusing to perform the original busted draw operation in question).
Attached patch fix v1 — — Splinter Review
Here's the fix. This patch makes us bail if |subimage| is zero-sized. (A little further down, we divide by subimage's width & height -- via a call to TransformBetweenRects -- which means we divide by 0. So, good to bail before that happens.) I've verified locally that this patch is sufficient to fix bug 1224736 (even in the absence of bug 1224736's own patch).
Attachment #8706661 - Flags: review?(tnikkel)
Attachment #8706661 - Flags: review?(tnikkel) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Product: Core → Core Graveyard
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: