summaryrefslogtreecommitdiffstats
path: root/src/file_mp3.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-04-11 18:44:51 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-04-11 18:44:51 +0200
commit5febf50acaf0e023b52ba04e41f69bf59c1a3cbe (patch)
tree31854eaf1bea8c044affac626c3c4e0c39355d07 /src/file_mp3.c
parent968b8fd059dc9528d295c1fc4aa362a810d04fde (diff)
PhotoRec: modify mp3 signature - reduce the number of time where header_check_mp3 is called
Diffstat (limited to 'src/file_mp3.c')
-rw-r--r--src/file_mp3.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/file_mp3.c b/src/file_mp3.c
index fe1017a..be318b1 100644
--- a/src/file_mp3.c
+++ b/src/file_mp3.c
@@ -457,8 +457,17 @@ static unsigned int search_MMT(const unsigned char *buffer, const unsigned int i
static void register_header_check_mp3(file_stat_t *file_stat)
{
- static const unsigned char id3_header[3]= {'I','D','3'};
- static const unsigned char mp3_header[1]= {0xFF};
- register_header_check(0, id3_header,sizeof(id3_header), &header_check_id3, file_stat);
- register_header_check(0, mp3_header,sizeof(mp3_header), &header_check_mp3, file_stat);
+ static const unsigned char mpeg1_L3_header1[2]= {0xFF, 0xFA};
+ static const unsigned char mpeg1_L3_header2[2]= {0xFF, 0xFB};
+ static const unsigned char mpeg2_L3_header1[2]= {0xFF, 0xF2};
+ static const unsigned char mpeg2_L3_header2[2]= {0xFF, 0xF3};
+ static const unsigned char mpeg25_L3_header1[2]={0xFF, 0xE2};
+ static const unsigned char mpeg25_L3_header2[2]={0xFF, 0xE3};
+ register_header_check(0, "ID3", 3, &header_check_id3, file_stat);
+ register_header_check(0, mpeg1_L3_header1, sizeof(mpeg1_L3_header1), &header_check_mp3, file_stat);
+ register_header_check(0, mpeg1_L3_header2, sizeof(mpeg1_L3_header2), &header_check_mp3, file_stat);
+ register_header_check(0, mpeg2_L3_header1, sizeof(mpeg2_L3_header1), &header_check_mp3, file_stat);
+ register_header_check(0, mpeg2_L3_header2, sizeof(mpeg2_L3_header2), &header_check_mp3, file_stat);
+ register_header_check(0, mpeg25_L3_header1, sizeof(mpeg25_L3_header1), &header_check_mp3, file_stat);
+ register_header_check(0, mpeg25_L3_header2, sizeof(mpeg25_L3_header2), &header_check_mp3, file_stat);
}