PhotoRec: do not search text files when another file is recovered except if it's also a text file

This commit is contained in:
Christophe Grenier 2017-03-03 07:00:53 +01:00
parent 6a04c03af2
commit 626d38fcd0

View file

@ -1108,32 +1108,12 @@ static int header_check_txt(const unsigned char *buffer, const unsigned int buff
}
if(file_recovery->file_stat!=NULL)
{
if(file_recovery->file_stat->file_hint == &file_hint_doc)
{
return 0;
}
else if(file_recovery->file_stat->file_hint == &file_hint_fasttxt ||
if(file_recovery->file_stat->file_hint == &file_hint_fasttxt ||
file_recovery->file_stat->file_hint == &file_hint_txt)
{
if(strstr(file_recovery->filename,".html")==NULL)
return 0;
}
else if(file_recovery->file_stat->file_hint == &file_hint_jpg)
{
/* Don't search text at the beginning of JPG */
if(file_recovery->file_size < file_recovery->min_filesize)
return 0;
/* Text should not be found in JPEG */
if(td_memmem(buffer, buffer_size_test, "8BIM", 4)!=NULL ||
td_memmem(buffer, buffer_size_test, "adobe", 5)!=NULL ||
td_memmem(buffer, buffer_size_test, "exif:", 5)!=NULL ||
td_memmem(buffer, buffer_size_test, "<rdf:", 5)!=NULL ||
td_memmem(buffer, buffer_size_test, "<?xpacket", 9)!=NULL ||
td_memmem(buffer, buffer_size_test, "<dict>", 6)!=NULL ||
td_memmem(buffer, buffer_size_test, "xmp:CreatorTool>", 16)!=NULL ||
td_memmem(buffer, buffer_size_test, "[camera info]", 13)!=NULL)
return 0;
}
else
return 0;
}