Skip to content

Catch invalid device resolution or units (segmentation fault) #82

@hsbadr

Description

@hsbadr

If the user passes large resolution or inappropriate units, some devices are unable to start or cause a segmentation fault.

Examples:

> ragg::agg_png(res = 100, units = "in")
Error in ragg::agg_png(res = 100, units = "in") :
  C++ exception: std::bad_alloc
> ragg::agg_png(res = 300, units = "in")

 *** caught segfault ***
address 0x14699b355000, cause 'invalid permissions'

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

This is caught by grDevices as follows:

> grDevices::png(res = 300, units = "in")
Error in grDevices::png(res = 300, units = "in") :
  unable to start device 'png'
In addition: Warning message:
In grDevices::png(res = 300, units = "in") :
  cairo error 'invalid value (typically too big) for the size of the input (surface, pattern, etc.)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions