diff options
author | Andrey Kiselev <dron@ak4719.spb.edu> | 2007-04-07 15:14:30 +0000 |
---|---|---|
committer | Andrey Kiselev <dron@ak4719.spb.edu> | 2007-04-07 15:14:30 +0000 |
commit | 46f6411b2c86424b6bd0368abee13b8937085c3f (patch) | |
tree | 7e047a29955422886ba93030300d151769e26961 /libtiff/tif_zip.c | |
parent | 7acb6903d501cc14674730c9af803cd470c0835a (diff) | |
download | libtiff-git-46f6411b2c86424b6bd0368abee13b8937085c3f.tar.gz |
Finally fix bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1274 by
introducing _TIFFMergeFieldInfo() returning integer error status instead of
void in case of problems with field merging (e.g., if the field with such a tag
already registered). TIFFMergeFieldInfo() in public API remains void. Use
_TIFFMergeFieldInfo() everywhere and check returned value.
Diffstat (limited to 'libtiff/tif_zip.c')
-rw-r--r-- | libtiff/tif_zip.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libtiff/tif_zip.c b/libtiff/tif_zip.c index 355c6622..361b849e 100644 --- a/libtiff/tif_zip.c +++ b/libtiff/tif_zip.c @@ -1,4 +1,4 @@ -/* $Id: tif_zip.c,v 1.13 2007-03-31 01:41:11 joris Exp $ */ +/* $Id: tif_zip.c,v 1.14 2007-04-07 15:14:31 dron Exp $ */ /* * Copyright (c) 1995-1997 Sam Leffler @@ -342,12 +342,23 @@ static const TIFFFieldInfo zipFieldInfo[] = { int TIFFInitZIP(TIFF* tif, int scheme) { + const char module[] = "TIFFInitZIP"; ZIPState* sp; assert( (scheme == COMPRESSION_DEFLATE) || (scheme == COMPRESSION_ADOBE_DEFLATE)); /* + * Merge codec-specific tag information. + */ + if (!_TIFFMergeFieldInfo(tif, zipFieldInfo, + TIFFArrayCount(zipFieldInfo))) { + TIFFErrorExt(tif->tif_clientdata, module, + "Merging Deflate codec-specific tags failed"); + return 0; + } + + /* * Allocate state block so tag methods have storage to record values. */ tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (ZIPState)); @@ -360,10 +371,8 @@ TIFFInitZIP(TIFF* tif, int scheme) sp->stream.data_type = Z_BINARY; /* - * Merge codec-specific tag information and - * override parent get/set field methods. + * Override parent get/set field methods. */ - _TIFFMergeFieldInfo(tif, zipFieldInfo, TIFFArrayCount(zipFieldInfo)); sp->vgetparent = tif->tif_tagmethods.vgetfield; tif->tif_tagmethods.vgetfield = ZIPVGetField; /* hook for codec tags */ sp->vsetparent = tif->tif_tagmethods.vsetfield; @@ -394,7 +403,7 @@ TIFFInitZIP(TIFF* tif, int scheme) (void) TIFFPredictorInit(tif); return (1); bad: - TIFFErrorExt(tif->tif_clientdata, "TIFFInitZIP", + TIFFErrorExt(tif->tif_clientdata, module, "No space for ZIP state block"); return (0); } |