Skip to content

[GTK] Insufficient pointer validation when creating new Cairo surface #2809

@ptziegler

Description

@ptziegler

Describe the bug

When creating a Cairo surface, an SWT error is thrown if a null pointer is returned.

surface = Cairo.cairo_image_surface_create(format, dataWidth, dataHeight);
if (surface == 0) SWT.error(SWT.ERROR_NO_HANDLES);

But per the documentation of this method:

This function always returns a valid pointer, but it will return a pointer to a "nil" surface if an error such as out of memory occurs. You can use cairo_surface_status() to check for this.

Note: The same is true for gdk_window_create_similar_surface

In short: This check should always succeed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions