summaryrefslogtreecommitdiffstats
path: root/src/file_mpg.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-05-30 18:06:45 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2008-05-30 18:06:45 +0200
commit03921e92a350951da4b6c0d79cc5bacb7d6de7e6 (patch)
tree8cf7cb7ddef09e3f7bb7041daa1871ef994763ab /src/file_mpg.c
parent300ca7a483dd54e0e9518d4953e83f57c992f57d (diff)
Better signature for MPEG file beginning by a system header start code
Diffstat (limited to 'src/file_mpg.c')
-rw-r--r--src/file_mpg.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/file_mpg.c b/src/file_mpg.c
index 22f8e5b..2c50075 100644
--- a/src/file_mpg.c
+++ b/src/file_mpg.c
@@ -59,6 +59,8 @@ static int header_check_mpg(const unsigned char *buffer, const unsigned int buff
* STREAM AND HEADERS *
* 0x000001BA pack header start code *
* 0x000001BB system header start code *
+ * 2 bytes: header_size
+ * 1 byte: stream_id
* 0x000001BE padding block start code *
* 0x000001BD private 1 block start code *
* 0x000001BF private 2 block start code *
@@ -75,7 +77,9 @@ static int header_check_mpg(const unsigned char *buffer, const unsigned int buff
if(buffer[0]==0x00 && buffer[1]==0x00 && buffer[2]==0x01 &&
(buffer[3]==0xB0 ||
(buffer[3]==0xB3 && ((buffer[4]<<8)+(buffer[5]>>8)>0) && ((buffer[5]<<8)+buffer[6]>0)) ||
- buffer[3]==0xB5 || buffer[3]==0xBA || buffer[3]==0xBB))
+ buffer[3]==0xB5 ||
+ buffer[3]==0xBA ||
+ (buffer[3]==0xBB && (buffer[4]<<8)+(buffer[5]>>8)>0 && (buffer[6]&0x80)==0x80)))
{
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_mpg.extension;