This happens with any GeoTIFF. Without "--config USE_RRD YES" it works. But I badly need external overviews as the same GeoTIFF is supposed to work in QGIS, benefitting from overviews speeding up the rendering, and in ArcPad, which happily ignores external overviews, but chokes on GeoTIFF with internal overviews.
Using GDAL 1.5 + SVN 13508 (the stable 1.5 branch), built from source on amd64 Ubuntu Dapper. This is a regression - the same used to work in GDAL 1.4.x on my machine.
Sample input attached. Backtrace:
$ gdb gdaladdo
GNU gdb 6.4-debian
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run --config USE_RRD YES sample.tif 2 4
Starting program: /usr/local/bin/gdaladdo --config USE_RRD YES sample.tif 2 4
[Thread debugging using libthread_db enabled]
[New Thread 46912561229536 (LWP 12342)]
warning: Lowest section in /usr/lib/libicudata.so.34 is .hash at 00000000000000e8
0...10...20...30...40...50...60...70...80...90...100 - done.
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912561229536 (LWP 12342)]
GDALDefaultOverviews::BuildOverviews (this=0x5171a8,
pszBasename=<value optimized out>, pszResampling=0x400f40 "nearest",
nOverviews=2, panOverviewList=0x7fffffe35580, nBands=1,
panBandList=0x517b70, pfnProgress=0x400ab0 <GDALTermProgress@plt>,
pProgressData=0x0) at gdaldefaultoverviews.cpp:520
520 poOverDS->oOvManager.poDS = poOverDS;
(gdb) bt
#0 GDALDefaultOverviews::BuildOverviews (this=0x5171a8,
pszBasename=<value optimized out>, pszResampling=0x400f40 "nearest",
nOverviews=2, panOverviewList=0x7fffffe35580, nBands=1,
panBandList=0x517b70, pfnProgress=0x400ab0 <GDALTermProgress@plt>,
pProgressData=0x0) at gdaldefaultoverviews.cpp:520
#1 0x00002aaaaae99598 in GDALDataset::IBuildOverviews (
this=<value optimized out>, pszResampling=0x0, nOverviews=5337512,
panOverviewList=0x2f, nListBands=8, panBandList=<value optimized out>,
pfnProgress=0x2, pProgressData=0x517150) at gdaldataset.cpp:1197
#2 0x00002aaaaad602d0 in GTiffDataset::IBuildOverviews (this=0x517150,
pszResampling=0x400f40 "nearest", nOverviews=2,
panOverviewList=0x7fffffe35580, nBands=1, panBandList=0x517b70,
pfnProgress=0x400ab0 <GDALTermProgress@plt>, pProgressData=0x0)
at geotiff.cpp:2163
#3 0x00002aaaaae985d8 in GDALDataset::BuildOverviews (this=0x517150,
pszResampling=0x400f40 "nearest", nOverviews=2,
panOverviewList=0x7fffffe35580, nListBands=1, panBandList=0x8,
pfnProgress=0x400ab0 <GDALTermProgress@plt>, pProgressData=0x517150)
at gdaldataset.cpp:1146
#4 0x0000000000400c52 in main (nArgc=<value optimized out>,
papszArgv=0x516070) at gdaladdo.cpp:102
Apparently, this is due to r12795 : "lots of magic related to building mask overviews with normal overviews". So I let it to FrankW. (There are clearly missing tests of pointers against NULL pointer).
In the meantime, if you want to create external overview, you might try this as a workaround: "chmod a-w sample.tif" and gdaladdo on it afterwards.