Skip to content
Snippets Groups Projects
Commit 0d5d4a32 authored by fwarmerdam's avatar fwarmerdam
Browse files

fixed buffer underflow bug (#2065)

parent 6427c7aa
No related branches found
No related tags found
No related merge requests found
2009-06-22 Frank Warmerdam <warmerdam@pobox.com>
* libtiff/tif_lzw.c: Fix buffer underflow bug.
http://bugzilla.maptools.org/show_bug.cgi?id=2065
2009-06-03 Frank Warmerdam <warmerdam@pobox.com>
* libtiff/tif_write.c: do not override the planar configuration to be
......
......@@ -675,6 +675,7 @@ LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
}
oldcodep = codep;
if (code >= 256) {
char *op_orig = op;
/*
* Code maps to a string, copy string
* value to output (written in reverse).
......@@ -709,7 +710,7 @@ LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
tp = op;
do {
*--tp = codep->value;
} while( (codep = codep->next) != NULL);
} while( (codep = codep->next) != NULL && tp > op_orig);
} else
*op++ = code, occ--;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment