summaryrefslogtreecommitdiffstats
path: root/src/file_m2ts.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_m2ts.c')
-rw-r--r--src/file_m2ts.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/file_m2ts.c b/src/file_m2ts.c
index 37fa38e..085ad9f 100644
--- a/src/file_m2ts.c
+++ b/src/file_m2ts.c
@@ -101,7 +101,8 @@ static int header_check_m2t(const unsigned char *buffer, const unsigned int buff
static int data_check_m2ts(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
- while(file_recovery->calculated_file_size + 5 < file_recovery->file_size + buffer_size/2)
+ while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
+ file_recovery->calculated_file_size + 5 < file_recovery->file_size + buffer_size/2)
{
unsigned int i=file_recovery->calculated_file_size - file_recovery->file_size + buffer_size/2;
if(buffer[i+4]!=0x47) /* TS_SYNC_BYTE */