[Shake-dev] GMT grdmath buffer overflow problem solved

C. Bruce Worden cbworden at usgs.gov
Wed Jan 29 22:13:10 UTC 2014


Hi all,

Some of you have been plagued with a buffer overflow problem that causes grdmath to quit and grind to fail, particularly on Ubuntu systems. Thanks to the diligence of Branden Christensen of OSOP we have a fix you can use until the next release of GMT.

In GMT 4.5.11, in the file gmt_grdio.c, at line 745 change:

	if (len > GRD_COMMAND_LEN) continue;

to:

	if (len >= GRD_COMMAND_LEN) continue;

You can then do "make" and "make install" in the GMT src directory and the fix will be included the GMT library. Finally, you can then go to <shake_home>/src/contour and do "make clean" and "make". (This last step may not be necessary, in particular if you compiled against the dynamic version of libgmt, but it doesn't hurt.) If you used a package manager to install GMT, you may have to remove that version and install GMT from source.

Presumably a similar change will fix earlier versions of GMT, but the change may not be on the same line of gmt_grdio.c, so some hunting might be necessary.

Even if you have never encountered the buffer overflow, you should consider this fix, as the bug could conceivably cause ShakeMap to fail unexpectedly.

Thanks again to Branden for sticking with this until a solution was found.

Bruce



More information about the Shake-dev mailing list