Opened 15 years ago
Closed 15 years ago
#2797 closed defect (fixed)
GDALOpenShared may crashes if dataset description is not the dataset filename
Reported by: | ftrastour | Owned by: | Even Rouault |
---|---|---|---|
Priority: | normal | Milestone: | 1.6.1 |
Component: | GDAL_Raster | Version: | 1.6.0 |
Severity: | normal | Keywords: | |
Cc: | warmerdam |
Description
GDALOpenShared crashes when called twice on the same dataset if the string returned by GetDescription is not the filename used to open the dataset.
GDALOpenShared sometimes uses the filename to register a dataset :
* gdaldataset.cpp/line 2017
sStruct.pszDescription = (char*) pszFilename;
and sometimes the string returnd by GetDescription :
* gdaldataset.cpp/line 1031
psStruct->pszDescription = CPLStrdup(GetDescription());
Change History (2)
comment:1 by , 15 years ago
Cc: | added |
---|---|
Milestone: | → 1.6.1 |
Owner: | changed from | to
Version: | unspecified → 1.6.0 |
comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I'll take care of this, as it is due to a change in 1.6.0 in the way we are managing the list of shared dataset (the change was to enable GDALOpen/Close to have ~ O(1) performance versus O(n) previously where n is the number of currently opened datasets).
However note that the documentation of GDALOpenShared has always said :
I've also checked GDAL 1.5.X code, and GDALOpenShared() would not work as expected if the filename was different from the dataset description returned by GetDescription().
I'll just avoid the crash and issue a warning when the situation is detected.