summaryrefslogtreecommitdiffstats
path: root/src/file_riff.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_riff.c
parent65543b032a3f3978f46add944c050d30e2d1a400 (diff)
PhotoRec: avoid potential endless loops
Diffstat (limited to 'src/file_riff.c')
-rw-r--r--src/file_riff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/file_riff.c b/src/file_riff.c
index d029431..e0b68bd 100644
--- a/src/file_riff.c
+++ b/src/file_riff.c
@@ -127,7 +127,7 @@ static void check_riff_list(file_recovery_t *fr, const unsigned int depth, const
log_riff_chunk(file_size, depth, &list_header);
#endif
}
- file_size += 8 + le32(list_header.dwSize);
+ file_size += (uint64_t)8 + le32(list_header.dwSize);
/* align to word boundary */
file_size += (file_size&1);
}
@@ -178,7 +178,7 @@ static data_check_t data_check_avi(const unsigned char *buffer, const unsigned i
const unsigned int i=file_recovery->calculated_file_size - file_recovery->file_size + buffer_size/2;
const riff_chunk_header *chunk_header=(const riff_chunk_header*)&buffer[i];
if(memcmp(&buffer[i], "RIFF", 4)==0 && memcmp(&buffer[i+8], "AVIX", 4)==0)
- file_recovery->calculated_file_size += 8 + le32(chunk_header->dwSize);
+ file_recovery->calculated_file_size += (uint64_t)8 + le32(chunk_header->dwSize);
else
return DC_STOP;
}
@@ -199,7 +199,7 @@ data_check_t data_check_avi_stream(const unsigned char *buffer, const unsigned i
#endif
return DC_STOP;
}
- file_recovery->calculated_file_size += 8 + le32(chunk_header->dwSize);
+ file_recovery->calculated_file_size += (uint64_t)8 + le32(chunk_header->dwSize);
#ifdef DEBUG_RIFF
log_info("data_check_avi_stream %llu\n", (long long unsigned)file_recovery->calculated_file_size);
#endif