PhotoRec: recover TIFF up to 1 GB (Previous limit was 100 MB)

This commit is contained in:
Christophe Grenier 2020-04-22 17:52:08 +02:00
parent 3840fa62b3
commit 04ec8987ca
3 changed files with 9 additions and 5 deletions

View file

@ -47,7 +47,7 @@ static void register_header_check_tiff(file_stat_t *file_stat);
const file_hint_t file_hint_tiff= {
.extension="tif",
.description="Tag Image File Format and some raw file formats (pef/nef/dcr/sr2/cr2)",
.max_filesize=100*1024*1024,
.max_filesize=1024*1024*1024,
.recover=1,
.enable_by_default=1,
.register_header_check=&register_header_check_tiff

View file

@ -174,13 +174,15 @@ unsigned int find_tag_from_tiff_header_be(const unsigned char *buffer, const uns
if(offset_tiff_next_diroff < tiff_size - 4)
{
const unsigned char *ptr_hdr;
const uint32_t *tiff_next_diroff;
unsigned int offset_ifd1;
/*@ assert offset_tiff_next_diroff + 4 <= tiff_size; */
ptr_hdr=&buffer[offset_tiff_next_diroff];
/*@ assert \valid_read(ptr_hdr + (0 .. 4-1)); */
const uint32_t *tiff_next_diroff=(const uint32_t *)ptr_hdr;
tiff_next_diroff=(const uint32_t *)ptr_hdr;
/*@ assert \valid_read(tiff_next_diroff); */
/* IFD1 */
const unsigned int offset_ifd1=be32(*tiff_next_diroff);
offset_ifd1=be32(*tiff_next_diroff);
if(offset_ifd1 > 0)
return find_tag_from_tiff_header_be_aux(buffer, tiff_size, tag, potential_error, offset_ifd1);
}

View file

@ -176,13 +176,15 @@ unsigned int find_tag_from_tiff_header_le(const unsigned char *buffer, const uns
if(offset_tiff_next_diroff < tiff_size - 4)
{
const unsigned char *ptr_hdr;
const uint32_t *tiff_next_diroff;
unsigned int offset_ifd1;
/*@ assert offset_tiff_next_diroff + 4 <= tiff_size; */
ptr_hdr=&buffer[offset_tiff_next_diroff];
/*@ assert \valid_read(ptr_hdr + (0 .. 4-1)); */
const uint32_t *tiff_next_diroff=(const uint32_t *)ptr_hdr;
tiff_next_diroff=(const uint32_t *)ptr_hdr;
/*@ assert \valid_read(tiff_next_diroff); */
/* IFD1 */
const unsigned int offset_ifd1=le32(*tiff_next_diroff);
offset_ifd1=le32(*tiff_next_diroff);
if(offset_ifd1 > 0)
return find_tag_from_tiff_header_le_aux(buffer, tiff_size, tag, potential_error, offset_ifd1);
}