static int tiff_load_ifd(imtiff *tiff, unsigned long offset);
static void tiff_final(imtiff *tiff);
static void tiff_clear_ifd(imtiff *tiff);
+#if 0 /* currently unused, but that may change */
static int tiff_get_bytes(imtiff *tiff, unsigned char *to, size_t offset,
size_t count);
+#endif
static int tiff_get_tag_double(imtiff *, int index, double *result);
static int tiff_get_tag_int(imtiff *, int index, int *result);
static unsigned tiff_get16(imtiff *, unsigned long offset);
entry->item_size = type_sizes[entry->type];
entry->size = entry->item_size * entry->count;
if (entry->size / entry->item_size != entry->count) {
+ myfree(entries);
mm_log((1, "Integer overflow calculating tag data size processing EXIF block\n"));
return 0;
}
ifd_entry *entry;
unsigned long offset;
if (index < 0 || index >= tiff->ifd_size) {
- m_fatal(3, "tiff_get_tag_double_array() tag index out of range");
+ i_fatal(3, "tiff_get_tag_double_array() tag index out of range");
}
entry = tiff->ifd + index;
tiff_get_tag_double(imtiff *tiff, int index, double *result) {
ifd_entry *entry;
if (index < 0 || index >= tiff->ifd_size) {
- m_fatal(3, "tiff_get_tag_double() index out of range");
+ i_fatal(3, "tiff_get_tag_double() index out of range");
}
entry = tiff->ifd + index;
ifd_entry *entry;
unsigned long offset;
if (index < 0 || index >= tiff->ifd_size) {
- m_fatal(3, "tiff_get_tag_int_array() tag index out of range");
+ i_fatal(3, "tiff_get_tag_int_array() tag index out of range");
}
entry = tiff->ifd + index;
if (array_index < 0 || array_index >= entry->count) {
- m_fatal(3, "tiff_get_tag_int_array() array index out of range");
+ i_fatal(3, "tiff_get_tag_int_array() array index out of range");
}
offset = entry->offset + array_index * entry->item_size;
tiff_get_tag_int(imtiff *tiff, int index, int *result) {
ifd_entry *entry;
if (index < 0 || index >= tiff->ifd_size) {
- m_fatal(3, "tiff_get_tag_int() index out of range");
+ i_fatal(3, "tiff_get_tag_int() index out of range");
}
entry = tiff->ifd + index;
*workstr = '\0';
for (j = 0; j < entry->count; ++j) {
if (!tiff_get_tag_double_array(tiff, tag_index, &value, j)) {
- m_fatal(3, "unexpected failure from tiff_get_tag_double_array(..., %d, ..., %d)\n", tag_index, j);
+ i_fatal(3, "unexpected failure from tiff_get_tag_double_array(..., %d, ..., %d)\n", tag_index, j);
}
if (j)
strcat(workstr, " ");
*workstr = '\0';
for (j = 0; j < entry->count; ++j) {
if (!tiff_get_tag_int_array(tiff, tag_index, &value, j)) {
- m_fatal(3, "unexpected failure from tiff_get_tag_int_array(..., %d, ..., %d)\n", tag_index, j);
+ i_fatal(3, "unexpected failure from tiff_get_tag_int_array(..., %d, ..., %d)\n", tag_index, j);
}
if (j)
strcat(workstr, " ");
static unsigned
tiff_get16(imtiff *tiff, unsigned long offset) {
if (offset + 2 > tiff->size)
- m_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size);
+ i_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size);
if (tiff->type == tt_intel)
return tiff->base[offset] + 0x100 * tiff->base[offset+1];
static unsigned
tiff_get32(imtiff *tiff, unsigned long offset) {
if (offset + 4 > tiff->size)
- m_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size);
+ i_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size);
if (tiff->type == tt_intel)
return tiff->base[offset] + 0x100 * tiff->base[offset+1]
+ 0x10000 * tiff->base[offset+1] + 0x1000000 * tiff->base[offset];
}
+#if 0 /* currently unused, but that may change */
+
/*
=item tiff_get_bytes
return 1;
}
+#endif
+
/*
=item tiff_get16s
int result;
if (offset + 2 > tiff->size)
- m_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size);
+ i_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size);
if (tiff->type == tt_intel)
result = tiff->base[offset] + 0x100 * tiff->base[offset+1];
unsigned work;
if (offset + 4 > tiff->size)
- m_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size);
+ i_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size);
if (tiff->type == tt_intel)
work = tiff->base[offset] + 0x100 * tiff->base[offset+1]
tiff_get_rat(imtiff *tiff, unsigned long offset) {
unsigned long numer, denom;
if (offset + 8 > tiff->size)
- m_fatal(3, "attempt to get_rat at %lu in %lu image", offset, tiff->size);
+ i_fatal(3, "attempt to get_rat at %lu in %lu image", offset, tiff->size);
numer = tiff_get32(tiff, offset);
denom = tiff_get32(tiff, offset+4);
tiff_get_rats(imtiff *tiff, unsigned long offset) {
long numer, denom;
if (offset + 8 > tiff->size)
- m_fatal(3, "attempt to get_rat at %lu in %lu image", offset, tiff->size);
+ i_fatal(3, "attempt to get_rat at %lu in %lu image", offset, tiff->size);
numer = tiff_get32s(tiff, offset);
denom = tiff_get32s(tiff, offset+4);