Closed
Bug 1169609
Opened 10 years ago
Closed 10 years ago
`setLineDash([0])` crashes canvas on Linux
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: richard.goater27, Assigned: lsalzman, NeedInfo)
Details
(Whiteboard: [gfx-noted])
Attachments
(2 files)
1.32 KB,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
1.24 KB,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0
Build ID: 20150527220518
Steps to reproduce:
Discovered the problem in my own app but it is reproducible at https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash.
On a Linux build (I'm running on Ubuntu), set the first line of the editable example to: `ctx.setLineDash([0])`.
The problem does not occur on a Mac build of version 38.
Actual results:
No line is drawn and the canvas becomes unresponsive to all further method calls.
Expected results:
A solid line should be drawn and drawing should resume on editing the example script.
Do you have a crash report in about:crashes? or a stacktrace? https://developer.mozilla.org/en-US/docs/How_to_get_a_stacktrace_for_a_bug_report
Flags: needinfo?(richard.goater27)
Reporter | ||
Comment 2•10 years ago
|
||
Sorry Loic, perhaps using the word 'crash' in the title was a mistake on my part. The browser is not actually crashing, just the canvas becomes unresponsive, almost as if it has "crashed" behind the scenes. Is there any other information I can provide?
Updated•10 years ago
|
Whiteboard: [gfx-noted]
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → lsalzman
Assignee | ||
Comment 3•10 years ago
|
||
As per the Cairo document for cairo_set_dash:
* If any value in @dashes is negative, or if all values are 0, then
* @cr will be put into an error state with a status of
* %CAIRO_STATUS_INVALID_DASH.
This patch just ensures that all-zero patterns are avoided to avoid letting the context get put into the error state. Negatives are handled higher up in the canvas context code, but the canvas spec does not seem to mention how to handle zeros (especially if the dash pattern is read back in JS), so for now just handle it in the cairo helper code.
Attachment #8613729 -
Flags: review?(jmuizelaar)
Assignee | ||
Updated•10 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment 4•10 years ago
|
||
Comment on attachment 8613729 [details] [diff] [review]
Avoid all-zero patterns that would trigger the CAIRO_STATUS_INVALID_DASH error state
Review of attachment 8613729 [details] [diff] [review]:
-----------------------------------------------------------------
Can you add a test for this? An upstream web-platform-test is probably best, but I'd be happy with any kind of test.
Attachment #8613729 -
Flags: review?(jmuizelaar) → review+
Assignee | ||
Comment 5•10 years ago
|
||
This patch adds a case to an existing canvas line dash test, to see if setting an all zero or negative line dash pattern leaves the context in an error state.
Try run for both cairo dash fix and test patch: https://treeherder.mozilla.org/#/jobs?repo=try&revision=604cc5d57ba2
Attachment #8614682 -
Flags: review?(jmuizelaar)
Updated•10 years ago
|
Attachment #8614682 -
Flags: review?(jmuizelaar) → review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/42b53aaa27da
https://hg.mozilla.org/integration/mozilla-inbound/rev/3ad3e245ee8b
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/42b53aaa27da
https://hg.mozilla.org/mozilla-central/rev/3ad3e245ee8b
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•