Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#4066 closed defect (fixed)

TerrasarX: memory access violation, memory leak

Reported by: belikov Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: default Version: 1.8.0
Severity: normal Keywords:
Cc:

Description

In frmts\tsx\tsxdataset.cpp, line ~515:

Code:

pszPath = CPLFormFilename(
                CPLGetDirname( poOpenInfo->pszFilename ),
                GetFilePath(psComponent, &pszType),
                "" );

Function CPLGetDirname() internally uses CPLFormFilename(), which returns pointer to local static buffer, and also CPLGetDirname() returns this pointer. So first arg passed to CPLFormFilename() is the pointer to its own static buffer. Sometimes it leads to crush.

Solution is to copy result of CPLGetDirname(poOpenInfo->pszFilename) to temporary buffer and pass it to CPLFormFilename().

Also string returned by GetFilePath() never been freed - small memleak

Change History (2)

comment:1 by Even Rouault, 13 years ago

Milestone: 1.9.0
Resolution: fixed
Status: newclosed

I think the issue about CPLGetDirname() and CPLFormFilename() is a non-issue since GDAL 1.8.0, and more precisely http://trac.osgeo.org/gdal/changeset/20754. Are you 100% positive it is still an issue in GDAL 1.8.0 (it was in previous versions for sure) ?

And the memleak has been fixed in http://trac.osgeo.org/gdal/changeset/21987 (1.9.0dev).

comment:2 by belikov, 13 years ago

Yes, I didn't know about http://trac.osgeo.org/gdal/changeset/20754. It was an issue in v1.7.2. It looks like it should fix this bug.

Note: See TracTickets for help on using tickets.