PhotoRec: fix when carving jpg with blocksize forced to 1 byte
This commit is contained in:
parent
c19ec047b8
commit
f73ae37ab8
3 changed files with 17 additions and 1 deletions
|
@ -1656,6 +1656,8 @@ static void file_check_jpg(file_recovery_t *file_recovery)
|
|||
{
|
||||
uint64_t thumb_offset;
|
||||
static uint64_t thumb_error=0;
|
||||
if(file_recovery->calculated_file_size<=2)
|
||||
file_recovery->calculated_file_size=0;
|
||||
/* FIXME REMOVE ME */
|
||||
file_recovery->flags=1;
|
||||
file_recovery->file_size=0;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "log.h"
|
||||
|
||||
extern const file_hint_t file_hint_raf;
|
||||
extern const file_hint_t file_hint_jpg;
|
||||
|
||||
static void register_header_check_tiff(file_stat_t *file_stat);
|
||||
static uint64_t header_check_tiff_be(file_recovery_t *fr, const uint32_t tiff_diroff, const unsigned int depth, const unsigned int count);
|
||||
|
@ -315,6 +316,12 @@ static int header_check_tiff_be_new(const unsigned char *buffer, const unsigned
|
|||
const TIFFHeader *header=(const TIFFHeader *)buffer;
|
||||
if((uint32_t)be32(header->tiff_diroff) < sizeof(TIFFHeader))
|
||||
return 0;
|
||||
if(file_recovery->file_stat!=NULL &&
|
||||
file_recovery->file_stat->file_hint==&file_hint_jpg)
|
||||
{
|
||||
header_ignored(file_recovery_new);
|
||||
return 0;
|
||||
}
|
||||
reset_file_recovery(file_recovery_new);
|
||||
file_recovery_new->extension=file_hint_tiff.extension;
|
||||
if(find_tag_from_tiff_header_be(header, buffer_size, TIFFTAG_DNGVERSION, &potential_error)!=NULL)
|
||||
|
@ -357,6 +364,12 @@ static int header_check_tiff_le_new(const unsigned char *buffer, const unsigned
|
|||
header_ignored(file_recovery_new);
|
||||
return 0;
|
||||
}
|
||||
if(file_recovery->file_stat!=NULL &&
|
||||
file_recovery->file_stat->file_hint==&file_hint_jpg)
|
||||
{
|
||||
header_ignored(file_recovery_new);
|
||||
return 0;
|
||||
}
|
||||
reset_file_recovery(file_recovery_new);
|
||||
file_recovery_new->extension=file_hint_tiff.extension;
|
||||
/* Canon RAW */
|
||||
|
|
|
@ -862,7 +862,8 @@ static int header_check_xmp(const unsigned char *buffer, const unsigned int buff
|
|||
if(buffer[35]=='\0')
|
||||
return 0;
|
||||
if(file_recovery->file_stat!=NULL &&
|
||||
(file_recovery->file_stat->file_hint==&file_hint_pdf ||
|
||||
(file_recovery->file_stat->file_hint==&file_hint_jpg ||
|
||||
file_recovery->file_stat->file_hint==&file_hint_pdf ||
|
||||
file_recovery->file_stat->file_hint==&file_hint_tiff))
|
||||
return 0;
|
||||
/* Adobe's Extensible Metadata Platform */
|
||||
|
|
Loading…
Reference in a new issue