[Gdal-dev] /MD on Windows, SDTS problem and fix

Frank Warmerdam warmerdam at pobox.com
Thu May 22 15:15:09 EDT 2003


Ben Discoe wrote:
> Recently i've been hitting memory problems with OGR, so i wanted to switch
> to using /MD to build GDAL with MSVC.  In fact, i notice that this change
> was checked into nmake.opt recently as well - and it's a good move.
> 
> However, switching to /MD caused a bug to pop up with using OGR to read
> certain SDTS files.  I have tracked the bug down, and found it has to do
> with using realloc() on a string that is precisely the length of its buffer,
> which can cause (depending on heap conditions) an unterminated string and
> subsequent crash.
> 
> Here is the 1-line fix:
> 
> RCS file: /cvsroot/osrs/gdal/frmts/iso8211/ddffielddefn.cpp,v
> diff -w -r1.9 ddffielddefn.cpp
> 456c456
> <                 if( (int) (strlen(pszExpandedContents) + strlen(pszDest))
> ---
> 
>>                if( (int) (strlen(pszExpandedContents) + strlen(pszDest) +
> 
> 1)

Ben,

I have committed this change.

Thanks Ben!

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list