Bug 96482 - Cairo 1.15.2: Crash in cairo_fill if target surface is created with cairo_win32_surface_create
Summary: Cairo 1.15.2: Crash in cairo_fill if target surface is created with cairo_win...
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: win32 backend (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: cairo-bugs mailing list
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-10 16:28 UTC by Awi
Modified: 2018-02-25 16:43 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Awi 2016-06-10 16:28:31 UTC
Environment: Cairo 1.15.2, Windows 7 x64.

When DC passed to cairo_win32_surface_create() has device origin (x or y coordinate) > 0 (set with SetViewportOrgEx Win API) then there is raised an "access violation" error when cairo_fill() is invoked.
If x and y coordinates of DC origin <= 0 then everything works fine.

You can find below a code snippet to reproduce the issue:

const int devX = 10;
const int devY = 0;

HDC hdc = ::CreateCompatibleDC(NULL);
HBITMAP hbmp = CreateCompatibleBitmap(hdc, 100, 100);
HGDIOBJ hObjPrev = ::SelectObject(hdc, hbmp);
::SetViewportOrgEx(hdc, devX, devY, NULL);

cairo_surface_t* surface = cairo_win32_surface_create(hdc);
cairo_t* context = cairo_create(surface);

cairo_rectangle(context, 0, 0, 90, 90);

cairo_set_source_rgba(context, 0, 1, 0, 0.5);
cairo_set_fill_rule(context, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill(context);
cairo_destroy(context);
cairo_surface_write_to_png(surface, "test.png");
cairo_surface_destroy(surface);

::SelectObject(hdc, hObjPrev);
::DeleteObject(hbmp);
::DeleteDC(hdc);
Comment 1 Bryce Harrington 2018-02-06 23:18:12 UTC
A patch has landed to trunk to fix bug 100793, which claims it addresses the root cause leading to this bug.

Could you please re-test against the current master trunk to see if the crash issue is still reproducible?
Comment 2 Awi 2018-02-25 16:43:16 UTC
I can confirm that above mentioned patch fixes the issue.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.