Skip to content

grdimage crashes when saving cpt is requested via -C...+smy.cpt #8949

@mkononets

Description

@mkononets

grdimage crashes when saving cpt is requested using e.g. -Cgeo+smy.cpt. my.cpt is saved. Request to scale the pallete via +Uk is ignored (-Cgeo+Uk+smy.cpt), see the separate report #8950. The crash is triggered regardless of +Uk.
Manual session cleanup is needed after the crash (gmt clear sessions).

gmt grdimage @earth_relief_10m -Cgeo+Uk+smy.cpt -Vd -R110/155/-45/-10 -JM10c -B -png Australia -Vd
...
grdimage [INFORMATION]: gmt_grd_project: Output grid extrema [-12885.5/1658] exceed extrema of input grid [-6762/1619] due to resampling
grdimage [INFORMATION]: gmt_grd_project: Output grid clipped to input grid extrema
grdimage [DEBUG]: GMT_Destroy_Data: freed memory for a Grid for object 0
grdimage [DEBUG]: gmtlib_unregister_io: Unregistering object no 0 [n_objects = 3]
grdimage [DEBUG]: gmtlib_unregister_io: Object no 0 has non-NULL resource pointer
grdimage [INFORMATION]: Evaluate image pixel colors
grdimage [INFORMATION]: Basic z(x,y) -> color image with no illumination.
grdimage [INFORMATION]: Plotting 24-bit color image
PSL: Too many colors to make colormap - using 24-bit direct color instead.
PSL: DEFLATE compressed 172992 to 96673 bytes (44.1% savings at compression level 5)
grdimage [DEBUG]: Current size of half-baked PS file /home/mkononets/.gmt/sessions/gmt_session.3134949/gmt_0.ps- = 147221.
grdimage [DEBUG]: GMT_Destroy_Data: freed memory for a Grid for object 3
grdimage [DEBUG]: gmtlib_unregister_io: Unregistering object no 3 [n_objects = 2]
grdimage [DEBUG]: gmtlib_unregister_io: Object no 3 has non-NULL resource pointer
grdimage [DEBUG]: Object ID 4 : Registered CPT File my.cpt as an Output resource with geometry Volume [n_objects = 3]
grdimage [DEBUG]: gmtapi_begin_io: Output resource access is now enabled [container]
grdimage [DEBUG]: gmtapi_export_palette: Passed ID = 4 and mode = 0
grdimage [INFORMATION]: Write CPT to File my.cpt
grdimage [DEBUG]: Writing CPT to my.cpt
grdimage [DEBUG]: GMT_End_IO: Output resource access is now disabled
grdimage [DEBUG]: GMT_Destroy_Data: freed memory for a CPT for object 1
grdimage [DEBUG]: gmtlib_unregister_io: Unregistering object no 1 [n_objects = 2]
grdimage [DEBUG]: gmtlib_unregister_io: Object no 1 has non-NULL resource pointer
free(): invalid pointer
Aborted

The resulting my.cpt (NB +Uk was apparently ignored):

cat my.cpt
# ENABLE_B_OPTION
-6762.00008381	black	-5916.75007333	20/30/53	L
-5916.75007333	20/30/53	-5071.50006286	38/60/106	L
-5071.50006286	38/60/106	-4226.25005238	46/80/133	L
-4226.25005238	46/80/133	-3381.00004191	53/99/160	L
-3381.00004191	53/99/160	-2535.75003143	72/151/211	L
-2535.75003143	72/151/211	-1690.50002095	90/185/233	L
-1690.50002095	90/185/233	-845.250010476	141/210/239	L
-845.250010476	141/210/239	0	245/255/255	L
0	0/97/71	16.5204090185	16/122/47	L
16.5204090185	16/122/47	165.204090185	232/215/125	L
165.204090185	232/215/125	396.489816444	161/67/0	L
396.489816444	161/67/0	561.693906628	100/50/25	L
561.693906628	100/50/25	925.142905035	110/109/108	L
925.142905035	110/109/108	1321.63272148	255/254/253	L
1321.63272148	255/254/253	1619.00008381	255/254/253	B
B	black
F	white
N	gray

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions