"ASSERTION: viewport width must be nonnegative"

RESOLVED FIXED in mozilla13

Status

()

Core
SVG
RESOLVED FIXED
7 years ago
5 years ago

People

(Reporter: Jesse Ruderman, Assigned: heycam)

Tracking

(Blocks: 1 bug, {assertion, regression, testcase})

Trunk
mozilla13
x86
Mac OS X
assertion, regression, testcase
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

7 years ago
Created attachment 498787 [details]
testcase

###!!! ASSERTION: viewport width must be nonnegative!: 'aViewportWidth >= 0', file layout/svg/base/src/nsSVGUtils.cpp, line 797
(Reporter)

Comment 1

7 years ago
Created attachment 498788 [details]
stack trace
This is a new assertion that I added in bug 272288 yesterday, to tighten up assumptions in nsSVGUtils::GetViewBoxTransform.

Negative widths aren't valid for <image> or <svg>, according to the spec:
 "A negative value is an error (see Error processing)"
 http://www.w3.org/TR/SVG11/struct.html#ImageElementWidthAttribute
 http://www.w3.org/TR/SVG11/struct.html#SVGElementWidthAttribute

Not sure if we currently trigger error-handling-code for this case...  If we don't want to bail out earlier than this, we could always just pass "max(0, width)" instead of "width" into nsSVGUtils::GetViewBoxTransform for cases like this.

Comment 3

7 years ago
We don't trigger error handling code as we don't distinguish between different types of length when we parse them. i.e. width (no negatives allowed) and x (negatives OK).

We just want to bail as early as possible in a way that makes mRect in nsSVGPathGeometryFrame the empty rect.

Comment 4

7 years ago
i.e. calling  nsSVGUtils::GetViewBoxTransform is pretty pointless if width <= 0 as we're not going to draw anything.
(Assignee)

Comment 5

5 years ago
Created attachment 598633 [details] [diff] [review]
Bail out earlier when computing CTM of an <svg> element with negative width/height attributes.
Attachment #598633 - Flags: review?(longsonr)
(Assignee)

Updated

5 years ago
Assignee: nobody → cam
Status: NEW → ASSIGNED

Updated

5 years ago
Attachment #598633 - Flags: review?(longsonr) → review+
(Assignee)

Comment 6

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/94423051f0fd
Flags: in-testsuite+

Comment 7

5 years ago
https://hg.mozilla.org/mozilla-central/rev/94423051f0fd
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
You need to log in before you can comment on or make changes to this bug.