summaryrefslogtreecommitdiffstats
path: root/src/file_mxf.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2017-09-12 13:16:15 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2017-09-12 13:16:15 +0200
commitb75c2fca2a39cea956efff127c345c00e99486f0 (patch)
treede23d458cffe11c9568621c64b4815291fe3f0ba /src/file_mxf.c
parent65543b032a3f3978f46add944c050d30e2d1a400 (diff)
PhotoRec: avoid potential endless loops
Diffstat (limited to 'src/file_mxf.c')
-rw-r--r--src/file_mxf.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/file_mxf.c b/src/file_mxf.c
index 07c7364..d6715bb 100644
--- a/src/file_mxf.c
+++ b/src/file_mxf.c
@@ -81,22 +81,22 @@ static data_check_t data_check_mxf(const unsigned char *buffer, const unsigned i
switch(buffer[i+0x10])
{
case 0x81:
- file_recovery->calculated_file_size+=0x14+buffer[i+0x11];
+ file_recovery->calculated_file_size+=(uint64_t)0x14+buffer[i+0x11];
break;
case 0x82:
- file_recovery->calculated_file_size+=0x14+(buffer[i+0x11]<<8)+buffer[i+0x12];
+ file_recovery->calculated_file_size+=(uint64_t)0x14+(buffer[i+0x11]<<8)+buffer[i+0x12];
break;
case 0x83:
- file_recovery->calculated_file_size+=0x14+(buffer[i+0x11]<<16)+(buffer[i+0x12]<<8)+buffer[i+0x13];
+ file_recovery->calculated_file_size+=(uint64_t)0x14+(buffer[i+0x11]<<16)+(buffer[i+0x12]<<8)+buffer[i+0x13];
break;
case 0x84:
{
const uint32_t *p32=(const uint32_t*)&buffer[i+0x11];
- file_recovery->calculated_file_size+=0x14 + le32(*p32);
+ file_recovery->calculated_file_size+=(uint64_t)0x14 + le32(*p32);
}
break;
default:
- file_recovery->calculated_file_size+=0x14+buffer[i+0x10];
+ file_recovery->calculated_file_size+=(uint64_t)0x14+buffer[i+0x10];
break;
}
}