diff options
author | Andrey Kiselev <dron@ak4719.spb.edu> | 2006-03-15 12:48:24 +0000 |
---|---|---|
committer | Andrey Kiselev <dron@ak4719.spb.edu> | 2006-03-15 12:48:24 +0000 |
commit | a243e2c9a5a7e5f15206d1e3c8b157065ff333a9 (patch) | |
tree | ef6edf7f83de5402af103eff76349e8405f163e1 /tools/raw2tiff.c | |
parent | 80dc9736c259a09b2e47f19cef85d65be45f3c7c (diff) | |
download | libtiff-git-a243e2c9a5a7e5f15206d1e3c8b157065ff333a9.tar.gz |
Do not set RowsPerStrip larger than ImageLength. As per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=1110
Diffstat (limited to 'tools/raw2tiff.c')
-rw-r--r-- | tools/raw2tiff.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c index e21119c3..1963baf6 100644 --- a/tools/raw2tiff.c +++ b/tools/raw2tiff.c @@ -1,4 +1,4 @@ -/* $Id: raw2tiff.c,v 1.21 2006-02-07 11:08:31 dron Exp $ +/* $Id: raw2tiff.c,v 1.22 2006-03-15 12:48:24 dron Exp $ * * Project: libtiff tools * Purpose: Convert raw byte sequences in TIFF images @@ -270,8 +270,13 @@ main(int argc, char* argv[]) } bufsize = width * nbands * depth; buf1 = (unsigned char *)_TIFFmalloc(bufsize); - TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, - TIFFDefaultStripSize(out, rowsperstrip)); + + rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip); + if (rowsperstrip > length) { + rowsperstrip = length; + } + TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip ); + lseek(fd, hdr_size, SEEK_SET); /* Skip the file header */ for (row = 0; row < length; row++) { switch(interleaving) { |