summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-06-13 11:21:50 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2015-06-13 11:21:50 +0200
commitd5b19fa0e196a273ad7b1e5e3429a1335549358b (patch)
tree350bbfd5637e2d8bb7d25ba6b80d3ffed167fc52 /src
parenta2875d3e9fbf64f00e72ddbd0b4c417f5419228e (diff)
PhotoRec: avoid to recover a jpg if it's in the first 8192 bytes of a .rw2 file
Diffstat (limited to 'src')
-rw-r--r--src/file_jpg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/file_jpg.c b/src/file_jpg.c
index b6be793..63565cb 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 */