Opened 18 years ago
Last modified 18 years ago
#1156 closed defect (fixed)
segfault if GDAL is compiled with ECW due to incorrect GDALDeregister_ECW semantics
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
Please note, that in GDALRegister_ECW defined in frmts/ecw/ecwdataset.cpp one always call to NCSecwInit, but NCSecwShutdown is called in GDALDeregister_ECW only if gpapszCSLookup is true, which is wrong. Please consider following exampe: #include <stdio.h> #include <dlfcn.h> int main(void) { void (*gdalReg)(void); void (*gdalUnreg)(void); void * gdal = dlopen("libgdal.so", RTLD_LAZY); if (!gdal) perror ("Can't find GDAL lib!\n"); gdalReg = dlsym(gdal, "GDALAllRegister"); gdalUnreg = dlsym(gdal, "GDALDestroyDriverManager"); if ( !gdalReg || !gdalUnreg ) perror ("Can't find register/unregister procs"); gdalReg(); gdalUnreg(); dlclose(gdal); sleep(1); printf ("Vous est ici!"); } Compile with -ldl flag, and run it and program will crash with segfault. This is because NCSecwInit created four threads and noone cared to terminated this thread while calling to GDALDestroyDriverManager I encountered this unpleasant crash while using php_mapscript from Apache modphp.
Note:
See TracTickets
for help on using tickets.