Bug #994

makecpt 5.3.1 creates invalid color palettes

Added by MapMaker 6 months ago. Updated 5 months ago.

Status:ClosedStart date:2016-11-03
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.3.1 Platform:

Description

I'm having problems with makecpt 5.3.1 generating invalid color palettes.

GMT 5.2.1 produced the same output on both Ubuntu 14.04 and 16.04:

$ gmt --version
5.2.1
$ gmt makecpt -C255/0/0,0/255/0,0/0/255 -T0/10000/1000 -Z
0       red     1000    204/51/0
1000    204/51/0        2000    153/102/0
2000    153/102/0       3000    102/153/0
3000    102/153/0       4000    51/204/0
4000    51/204/0        5000    green
5000    green   6000    0/204/51
6000    0/204/51        7000    0/153/102
7000    0/153/102       8000    0/102/153
8000    0/102/153       9000    0/51/204
9000    0/51/204        10000   blue
B       black
F       white
N       127.5

With GMT 5.3.1, the output is scrambled.

Ubuntu 14.04:

$ gmt --version
5.3.1
$ gmt makecpt -C255/0/0,0/255/0,0/0/255 -T0/10000/1000 -Z
makecpt: Warning: Number of picked colors exceeds colors in input cpt!
0       red     1000    green
1000    green   2000    blue
2000    blue    3000    blue
3000    2.55e+05/0.255/255      4000    black@100
4000    5.1e+05/0.255/0@100     5000    black
5000    7.65e+05/0.255/0        6000    red
6000    1.02e+06/0.255/2.55e+05@0       7000    red
7000    1.275e+06/0.255/5.1e+05@0       8000    green
8000    1.53e+06/0.255/7.65e+05@0       9000    blue
9000    1.785e+06/0.255/1.02e+06@0      10000   2.55e+05/0.255/255
B       black
F       white
N       127.5

Ubuntu 16.04:

$ gmt --version
5.3.1
$ gmt makecpt -C255/0/0,0/255/0,0/0/255 -T0/10000/1000 -Z
makecpt: Warning: Number of picked colors exceeds colors in input cpt!
0       red     1000    green
1000    green   2000    blue
2000    blue    3000    blue
3000    black   4000    black
4000    black   5000    navy
5000    black   6000    0/127.5/255
6000    black   7000    black
7000    black   8000    black
8000    black   9000    black
9000    black   10000   black
B       black
F       white
N       127.5

makecpt 5.2.1 runs clean in Valgrind, but 5.3.1 doesn't. This is from Ubuntu 16.04:

$ valgrind gmt makecpt -C255/0/0,0/255/0,0/0/255 -T0/10000/1000 -Z
==60522== Memcheck, a memory error detector
==60522== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==60522== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==60522== Command: gmt makecpt -C255/0/0,0/255/0,0/0/255 -T0/10000/1000 -Z
==60522== 
makecpt: Warning: Number of picked colors exceeds colors in input cpt!
==60522== Invalid read of size 8
==60522==    at 0x4F10D19: gmt_sample_cpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x50943A8: GMT_makecpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x4E76D14: GMT_Call_Module (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x400E1A: main (in /usr/local/bin/gmt)
==60522==  Address 0x1a901488 is 24 bytes after a block of size 720 in arena "client" 
==60522== 
==60522== Invalid read of size 8
==60522==    at 0x4F10D1D: gmt_sample_cpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x50943A8: GMT_makecpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x4E76D14: GMT_Call_Module (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x400E1A: main (in /usr/local/bin/gmt)
==60522==  Address 0x1a9014a0 is 16 bytes before a block of size 88 alloc'd
==60522==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==60522==    by 0x4ECF76F: gmt_memory_func (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x5094DB5: GMT_makecpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x4E76D14: GMT_Call_Module (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x400E1A: main (in /usr/local/bin/gmt)
==60522== 
==60522== Invalid read of size 8
==60522==    at 0x4F10D25: gmt_sample_cpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x50943A8: GMT_makecpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x4E76D14: GMT_Call_Module (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x400E1A: main (in /usr/local/bin/gmt)
==60522==  Address 0x1a901490 is 32 bytes before a block of size 96 in arena "client" 
==60522== 
==60522== Invalid read of size 8
==60522==    at 0x4F10D2E: gmt_sample_cpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x50943A8: GMT_makecpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x4E76D14: GMT_Call_Module (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x400E1A: main (in /usr/local/bin/gmt)
==60522==  Address 0x1a901498 is 24 bytes before a block of size 88 alloc'd
==60522==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==60522==    by 0x4ECF76F: gmt_memory_func (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x5094DB5: GMT_makecpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x4E76D14: GMT_Call_Module (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x400E1A: main (in /usr/local/bin/gmt)
==60522== 
==60522== Invalid read of size 8
==60522==    at 0x4F10D3B: gmt_sample_cpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x50943A8: GMT_makecpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x4E76D14: GMT_Call_Module (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x400E1A: main (in /usr/local/bin/gmt)
==60522==  Address 0x1a9014a8 is 8 bytes before a block of size 88 alloc'd
==60522==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==60522==    by 0x4ECF76F: gmt_memory_func (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x5094DB5: GMT_makecpt (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x4E76D14: GMT_Call_Module (in /usr/local/lib/libgmt.so.5.3.1)
==60522==    by 0x400E1A: main (in /usr/local/bin/gmt)
==60522== 
0       red     1000    green
1000    green   2000    blue
2000    blue    3000    blue
3000    black   4000    0/0/2.55e+05@200000
4000    black   5000    black
5000    black   6000    black
6000    black@100       7000    0/0/0@100
7000    black   8000    red@-100
8000    red     9000    red
9000    black   10000   2.55e+05/5.1e+05/0
B       black
F       white
N       127.5
==60522== 
==60522== HEAP SUMMARY:
==60522==     in use at exit: 72,797 bytes in 6 blocks
==60522==   total heap usage: 3,560 allocs, 3,554 frees, 3,295,947 bytes allocated
==60522== 
==60522== LEAK SUMMARY:
==60522==    definitely lost: 61 bytes in 4 blocks
==60522==    indirectly lost: 0 bytes in 0 blocks
==60522==      possibly lost: 0 bytes in 0 blocks
==60522==    still reachable: 72,736 bytes in 2 blocks
==60522==         suppressed: 0 bytes in 0 blocks
==60522== Rerun with --leak-check=full to see details of leaked memory
==60522== 
==60522== For counts of detected and suppressed errors, rerun with: -v
==60522== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 0 from 0)

Associated revisions

Revision 17315
Added by Paul 6 months ago

Fixing issue #994

History

#1 Updated by Paul 6 months ago

  • Status changed from New to In Progress
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release

I can confirm the problem and will work on it today.

#2 Updated by Paul 6 months ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Should be fixed in r17315.

#3 Updated by Joaquim 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF