summaryrefslogtreecommitdiffstats
path: root/src/file_mpg.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-10-25 18:27:20 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2009-10-25 18:27:20 +0100
commita4c75d5c74f31aa09d8dd270b09dee00973a54c3 (patch)
treed664e081e2ddb9909b8e8232ce4cbb0915e48b40 /src/file_mpg.c
parent7cf77194c393f45d4e47c355a4400f4225108931 (diff)
PhotoRec: fix MPEG-1 system header start code detection
Diffstat (limited to 'src/file_mpg.c')
-rw-r--r--src/file_mpg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/file_mpg.c b/src/file_mpg.c
index 9ed5585..6b2ae7f 100644
--- a/src/file_mpg.c
+++ b/src/file_mpg.c
@@ -103,7 +103,10 @@ static int header_check_mpg(const unsigned char *buffer, const unsigned int buff
/* MPEG-1 system header start code */
(buffer[3]==0xBB && (buffer[6]&0x80)==0x80 && (buffer[8]&0x01)==0x01) ||
/* MPEG-1 sequence header code, horizontal size>0 && vertical size>0, bitrate!=0 */
- (buffer[3]==0xB3 && (buffer[4]<<8)+(buffer[5]>>8)>0 && (buffer[5]<<8)+buffer[6]>0 && buffer[8]!=0) ||
+ (buffer[3]==0xB3 &&
+ (buffer[4]<<4)+(buffer[5]>>4)>0 &&
+ ((buffer[5]&&0x0f)<<4)+buffer[6]>0 &&
+ buffer[8]!=0) ||
/* ISO/IEC 14496-2 (MPEG-4 video) ELEMENTARY VIDEO HEADER - visual object sequence start code */
(buffer[3]==0xB0) ||
/* ISO/IEC 14496-2 (MPEG-4 video) ELEMENTARY VIDEO HEADER - visual object start code */