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

2009.02.05 19:13 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Bob Friesenhahn

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.

Assertions should only be used to detect logic problems in the libtiff implementation or perhaps the using application. It would be a bug if an assertion is thrown by libtiff (rather than returning a warning or error) based on reading a file.

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

I have not heard of a build production process for open-source based systems which intentionally disables assertions. More than likely they are disabled in quite a few closed-source applications.

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.

This is a sure-fire way to ensure that there are no bug-reports regarding thrown assertions. Is that really what we want? Maybe we are using the assertions incorrectly.

Bob
======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/