From 53fb873cc2f5a093600f596a547cbd97381c3916 Mon Sep 17 00:00:00 2001 From: Andrey Kiselev Date: Tue, 17 May 2005 14:18:48 +0000 Subject: [PATCH] Check for JPEGTables tag presence before copying. --- tools/tiffsplit.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/tiffsplit.c b/tools/tiffsplit.c index 66f02c08..3387dee4 100644 --- a/tools/tiffsplit.c +++ b/tools/tiffsplit.c @@ -1,4 +1,4 @@ -/* $Id: tiffsplit.c,v 1.9 2004-06-05 08:11:26 dron Exp $ */ +/* $Id: tiffsplit.c,v 1.10 2005-05-17 14:18:48 dron Exp $ */ /* * Copyright (c) 1992-1997 Sam Leffler @@ -151,10 +151,12 @@ tiffcp(TIFF* in, TIFF* out) CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel); CopyField(TIFFTAG_COMPRESSION, compression); if (compression == COMPRESSION_JPEG) { - uint16 count; - void *table; - TIFFGetField(in, TIFFTAG_JPEGTABLES, &count, &table); - TIFFSetField(out, TIFFTAG_JPEGTABLES, count, table); + uint16 count = 0; + void *table = NULL; + if (TIFFGetField(in, TIFFTAG_JPEGTABLES, &count, &table) + && count > 0 && table) { + TIFFSetField(out, TIFFTAG_JPEGTABLES, count, table); + } } CopyField(TIFFTAG_PHOTOMETRIC, shortv); CopyField(TIFFTAG_PREDICTOR, shortv);