From d5b19fa0e196a273ad7b1e5e3429a1335549358b Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Sat, 13 Jun 2015 11:21:50 +0200 Subject: [PATCH] PhotoRec: avoid to recover a jpg if it's in the first 8192 bytes of a .rw2 file --- src/file_jpg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/file_jpg.c b/src/file_jpg.c index b6be793c..63565cb9 100644 --- a/src/file_jpg.c +++ b/src/file_jpg.c @@ -60,6 +60,7 @@ extern const file_hint_t file_hint_doc; extern const file_hint_t file_hint_indd; extern const file_hint_t file_hint_mov; extern const file_hint_t file_hint_riff; +extern const file_hint_t file_hint_rw2; extern data_check_t data_check_avi_stream(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery); static void register_header_check_jpg(file_stat_t *file_stat); @@ -423,6 +424,10 @@ static int header_check_jpg(const unsigned char *buffer, const unsigned int buff if( file_recovery->file_stat->file_hint==&file_hint_mov && memcmp(buffer, jpg_header_app0_jfif11_null, sizeof(jpg_header_app0_jfif11_null))==0) return 0; + /* Don't extract jpg inside rw2 */ + if( file_recovery->file_stat->file_hint==&file_hint_rw2 && + file_recovery->file_size <= 8192) + return 0; if(buffer[3]==0xdb) /* DQT */ return 0; if(buffer[3]==0xc4) /* DHT - needed to recover .cr2 */