2008.12.17 20:54 "[Tiff] Deleting tags from a directory", by Frank Warmerdam

2009.02.05 18:38 "[Tiff] assertions, and building with DEBUG/NDEBUG", by Frank Warmerdam

Folks,

Tavis Ormandy has reported some problems with corrupt tiff files that trigger assertions() in libtiff.

   http://bugzilla.maptools.org/show_bug.cgi?id=1995

It appears these assertions are being used to call to attention problems in these files for developers, and are intended to be compiled out in production software.

On investigation I see that NDEBUG needs to be defined to disable assertions. Previously I had assumed that it was sufficient to not define DEBUG but that does not appear to be the case.

So my question is, is it normal for people building for production purposes to build with NDEBUG defined?

I found I had to set CFLAGS=-DNDEBUG before configuring to disable asserts. I also notice that the windows makefiles make no mention of DEBUG or NDEBUG.

I am contemplating modifying tiffiop.h to explicitly define NDEBUG if DEBUG is not defined, before including assert.h. This would mean that assertions are compiled out by default, and only included if DEBUG is explicitly requested. I would also change Makefile.vc to define DEBUG for the debug build case.

Does anyone have thoughts on a more appropriate approach?

Best regards,
--
---------------------------------------+--------------------------------------

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam

and watch the world go round - Rush    | Geospatial Programmer for Rent