Skip to content

plot crashes when invalid aspatial name is passed #9153

Description

@seisman

To reproduce the issue, use the following dataset and commands:

wget "https://naciscdn.org/naturalearth/110m/cultural/ne_110m_admin_0_countries.zip"
unzip ne_110m_admin_0_countries.zip
gmt makecpt -Cturbo -T0/270000000/1000000 > test.cpt

# Works
$ gmt plot ne_110m_admin_0_countries.shp -W1p -G+z -aZ=POP_EST -pdf map -L -Ctest.cpt

# Crashes when an invalid aspatial property "POP" is passed:
$➜ gmt plot ne_110m_admin_0_countries.shp -W1p -G+z -aZ=POP -pdf map -L -Ctest.cpt
ERROR: Caught signal number 11 (Segmentation fault: 11) at
0   libsystem_platform.dylib            0x000000018195ea30 _platform_strnlen + 16
1   ???                                 0x0000000000000180 0x0 + 384
Stack backtrace:
0   libgmt.6.dylib                      0x0000000102ed3084 gmt_sig_handler_unix + 192
1   libsystem_platform.dylib            0x0000000181961744 _sigtramp + 56
2   libsystem_c.dylib                   0x00000001817f9cb4 strncat + 52
3   libgmt.6.dylib                      0x0000000102e49f80 gmtio_build_text_from_ogr + 156
4   libgmt.6.dylib                      0x0000000102e5233c gmtio_ascii_input + 11420
5   libgmt.6.dylib                      0x0000000102e5cfc8 gmtlib_read_table + 920
6   libgmt.6.dylib                      0x0000000102df58b0 gmtapi_import_dataset + 5360
7   libgmt.6.dylib                      0x0000000102deada8 GMT_Read_Data + 4356
8   libgmt.6.dylib                      0x00000001030f73ec GMT_psxy + 7636
9   libgmt.6.dylib                      0x0000000102e0cf18 GMT_Call_Module + 2272
10  gmt                                 0x000000010250e348 main + 1688
11  dyld                                0x000000018158c4e4 start + 6992

# Also crashes if -C option is not set
$ gmt plot ne_110m_admin_0_countries.shp -W1p -G+z -aZ=POP_EST -pdf map -L
ERROR: Caught signal number 11 (Segmentation fault: 11) at
0   libgmt.6.dylib                      0x000000010357b178 gmt_parse_segment_header + 580
1   ???                                 0x0000000000000124 0x0 + 292
Stack backtrace:
0   libgmt.6.dylib                      0x00000001035f3084 gmt_sig_handler_unix + 192
1   libsystem_platform.dylib            0x0000000181961744 _sigtramp + 56
2   libgmt.6.dylib                      0x000000010357afa0 gmt_parse_segment_header + 108
3   libgmt.6.dylib                      0x000000010381b424 GMT_psxy + 24076
4   libgmt.6.dylib                      0x000000010352cf18 GMT_Call_Module + 2272
5   gmt                                 0x0000000102d82348 main + 1688
6   dyld                                0x000000018158c4e4 start + 6992

I'm using GMT 6.7.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions