1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
$NetBSD: patch-ax,v 1.1 2004/10/18 14:37:24 tron Exp $
--- libtiff/tif_write.c.orig 2003-08-05 10:49:13.000000000 +0200
+++ libtiff/tif_write.c 2004-10-18 16:25:33.000000000 +0200
@@ -597,21 +597,30 @@
static int
TIFFGrowStrips(TIFF* tif, int delta, const char* module)
{
- TIFFDirectory *td = &tif->tif_dir;
+ TIFFDirectory *td = &tif->tif_dir;
+ uint32 *new_stripoffset, *new_stripbytecount;
assert(td->td_planarconfig == PLANARCONFIG_CONTIG);
- td->td_stripoffset = (uint32*)_TIFFrealloc(td->td_stripoffset,
- (td->td_nstrips + delta) * sizeof (uint32));
- td->td_stripbytecount = (uint32*)_TIFFrealloc(td->td_stripbytecount,
- (td->td_nstrips + delta) * sizeof (uint32));
- if (td->td_stripoffset == NULL || td->td_stripbytecount == NULL) {
+ new_stripoffset = (uint32*)_TIFFrealloc(td->td_stripoffset,
+ (td->td_nstrips + delta) * sizeof (uint32));
+ new_stripbytecount = (uint32*)_TIFFrealloc(td->td_stripbytecount,
+ (td->td_nstrips + delta) * sizeof (uint32));
+ if (new_stripoffset == NULL || new_stripbytecount == NULL) {
+ if (new_stripoffset)
+ _TIFFfree(new_stripoffset);
+ if (new_stripbytecount)
+ _TIFFfree(new_stripbytecount);
td->td_nstrips = 0;
TIFFError(module, "%s: No space to expand strip arrays",
- tif->tif_name);
+ tif->tif_name);
return (0);
}
- _TIFFmemset(td->td_stripoffset+td->td_nstrips, 0, delta*sizeof (uint32));
- _TIFFmemset(td->td_stripbytecount+td->td_nstrips, 0, delta*sizeof (uint32));
+ td->td_stripoffset = new_stripoffset;
+ td->td_stripbytecount = new_stripbytecount;
+ _TIFFmemset(td->td_stripoffset + td->td_nstrips,
+ 0, delta*sizeof (uint32));
+ _TIFFmemset(td->td_stripbytecount + td->td_nstrips,
+ 0, delta*sizeof (uint32));
td->td_nstrips += delta;
return (1);
}
|