Opened 12 years ago

Closed 11 years ago

#12 closed defect (fixed)

GTIFDirectoryInfo() called in GTIFGetProj4Defn() with bad pointer type.

Reported by: rouault Owned by: warmerdam
Priority: critical Milestone:
Component: libgeotiff Version:
Keywords: Cc: hobu

Description

Changeset r1564 is wrong. GTIFDirectoryInfo() is called with a GTIFDefn * pointer, but it expects a GTIF*, and both structures aren't compatible at all. GCC and MVSC both complain about that. I noticed that in gdal trunk as latest libgeotiff was recently synchronized in gdal (http://trac.osgeo.org/gdal/changeset/16819).

geotiff_proj4.c(854) : warning C4133: 'function' : incompatible types - from 'GTIFDefn *' to 'GTIF *'
geotiff_proj4.c: In function 'GTIFGetProj4Defn':
geotiff_proj4.c:854: warning: passing argument 1 of 'GTIFDirectoryInfo' from incompatible pointer type

Change History (4)

comment:1 Changed 12 years ago by hobu

hmm... how did that *ever* work? :) The problem is still there though -- how do we find out if a GTIFDefn is empty or not when .Model can't tell us (or changing the signature of GTIFGetProj4Defn)? If either of you see a way, please fix it. The length of ProjParmId? maybe?

comment:2 Changed 12 years ago by rouault

I have no idea how to fix it, but I'd encourage you to revert that change in the meanwhile, as it could likely cause memory corruption or crashes.

comment:3 Changed 11 years ago by hobu

Frank,

Which combination of things on the GTIFDefn* would denote that it isn't filled in? Should I write a function to test if everything in the GTIFDefn is 0 (which we'll have to remember to update if we change the definition of the GTIFDefn)? Is that enough to say the GTIFDefn* is nothing?

There's no way to get back the GTIF* from the GTIFDefn to run the directory info to find out the number of keys. It would be handy to add a pointer to the GTIFDefn that pointed back to its original GTIF*.

comment:4 Changed 11 years ago by warmerdam

Resolution: fixed
Status: newclosed

I have introduced a HaveDefn? field in the GTIFDefn structure which is set FALSE if there are no geokeys, and this is now used by geotiff_proj4.c. Changes are in trunk (r1640).

Note: See TracTickets for help on using tickets.