summaryrefslogtreecommitdiffstats
path: root/src/file_png.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-09-03 08:04:04 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2015-09-03 08:04:04 +0200
commit00557961744f0a88000678db179a84a4a0e4fdfd (patch)
treedb0bae677a788104fa71edaebcbfa30402833179 /src/file_png.c
parentac980c4a61e0158ce5ceec8555a89b38eac5066c (diff)
PhotoRec: reduce the number of backward search
Diffstat (limited to 'src/file_png.c')
-rw-r--r--src/file_png.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/file_png.c b/src/file_png.c
index f71f5a2..d61ae1f 100644
--- a/src/file_png.c
+++ b/src/file_png.c
@@ -129,17 +129,20 @@ static void file_check_png(file_recovery_t *fr)
static int header_check_png(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
{
+ if( !((isupper(buffer[8+4]) || islower(buffer[8+4])) &&
+ (isupper(buffer[8+5]) || islower(buffer[8+5])) &&
+ (isupper(buffer[8+6]) || islower(buffer[8+6])) &&
+ (isupper(buffer[8+7]) || islower(buffer[8+7]))))
+ return 0;
/* SolidWorks files contains a png */
if(file_recovery->file_stat!=NULL &&
file_recovery->file_stat->file_hint==&file_hint_doc &&
(strcmp(file_recovery->extension,"sld")==0 ||
strcmp(file_recovery->extension,"sldprt")==0))
+ {
+ header_ignored(file_recovery_new);
return 0;
- if( !((isupper(buffer[8+4]) || islower(buffer[8+4])) &&
- (isupper(buffer[8+5]) || islower(buffer[8+5])) &&
- (isupper(buffer[8+6]) || islower(buffer[8+6])) &&
- (isupper(buffer[8+7]) || islower(buffer[8+7]))))
- return 0;
+ }
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_png.extension;
file_recovery_new->min_filesize=16;