Репозитории ALT
S: | 4.4.0-alt4 |
5.1: | 3.9.5-alt1.M50P.1 |
4.1: | 3.8.2-alt2.M41.4 |
4.0: | 3.8.2-alt2 |
+updates: | 3.8.2-alt2 |
3.0: | 3.7.2-alt5 |
Группа :: Система/Библиотеки
Пакет: libtiff
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: libtiff-3.8.2-alt-tiffdump.patch
Скачать
Скачать
diff -upk.orig tiff-3.8.2.orig/tools/tiffdump.c tiff-3.8.2/tools/tiffdump.c
--- tiff-3.8.2.orig/tools/tiffdump.c 2005-12-02 16:01:33 +0000
+++ tiff-3.8.2/tools/tiffdump.c 2007-03-30 00:03:17 +0000
@@ -187,8 +187,8 @@ dump(int fd, off_t diroff)
{
unsigned i;
- lseek(fd, (off_t) 0, 0);
- if (read(fd, (char*) &hdr, sizeof (hdr)) != sizeof (hdr))
+ if (lseek(fd, (off_t) 0, 0) != (off_t) 0 ||
+ read(fd, (char*) &hdr, sizeof (hdr)) != sizeof (hdr))
ReadError("TIFF header");
/*
* Setup the byte order handling.
@@ -265,7 +265,7 @@ static off_t
ReadDirectory(int fd, unsigned ix, off_t off)
{
register TIFFDirEntry *dp;
- register unsigned int n;
+ register int n;
TIFFDirEntry *dir = 0;
uint16 dircount;
int space;
@@ -273,7 +273,7 @@ ReadDirectory(int fd, unsigned ix, off_t
if (off == 0) /* no more directories */
goto done;
- if (lseek(fd, (off_t) off, 0) != off) {
+ if (lseek(fd, off, 0) != off) {
Fatal("Seek error accessing TIFF directory");
goto done;
}
@@ -289,10 +289,14 @@ ReadDirectory(int fd, unsigned ix, off_t
goto done;
}
n = read(fd, (char*) dir, dircount*sizeof (*dp));
+ if (n < 0) {
+ ReadError("TIFF directory");
+ goto done;
+ }
if (n != dircount*sizeof (*dp)) {
n /= sizeof (*dp);
Error(
- "Could only read %u of %u entries in directory at offset %#lx",
+ "Could only read %d of %u entries in directory at offset %#lx",
n, dircount, (unsigned long) off);
dircount = n;
}
@@ -708,8 +712,9 @@ TIFFFetchData(int fd, TIFFDirEntry* dir,
w = (dir->tdir_type < NWIDTHS ? datawidth[dir->tdir_type] : 0);
cc = dir->tdir_count * w;
- if (lseek(fd, (off_t)dir->tdir_offset, 0) != (off_t)-1
- && read(fd, cp, cc) != -1) {
+ if (cc > 0
+ && lseek(fd, (off_t)dir->tdir_offset, 0) != (off_t)-1
+ && read(fd, cp, cc) == cc) {
if (swabflag) {
switch (dir->tdir_type) {
case TIFF_SHORT: