summaryrefslogtreecommitdiffstats
path: root/src/file_jpg.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_jpg.c
parent65543b032a3f3978f46add944c050d30e2d1a400 (diff)
PhotoRec: avoid potential endless loops
Diffstat (limited to 'src/file_jpg.c')
-rw-r--r--src/file_jpg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/file_jpg.c b/src/file_jpg.c
index b596cd2..e7da1b5 100644
--- a/src/file_jpg.c
+++ b/src/file_jpg.c
@@ -299,7 +299,7 @@ static void file_check_mpo(file_recovery_t *fr)
}
do
{
- offset+=2+size;
+ offset+=(uint64_t)2+size;
if(my_fseek(fr->handle, offset, SEEK_SET) < 0)
{
fr->file_size=0;
@@ -1481,7 +1481,7 @@ static uint64_t jpg_check_structure(file_recovery_t *file_recovery, const unsign
#ifdef DEBUG_JPEG
log_info("%s marker 0x%02x at 0x%x\n", file_recovery->filename, buffer[i+1], i);
#endif
- offset+=2+size;
+ offset+=(uint64_t)2+size;
if(buffer[i+1]==0xda) /* SOS: Start Of Scan */
{
file_recovery->offset_ok=i+1;
@@ -1813,7 +1813,7 @@ data_check_t data_check_jpg(const unsigned char *buffer, const unsigned int buff
(long long unsigned)file_recovery->calculated_file_size,
(long long unsigned)file_recovery->calculated_file_size+2+size);
#endif
- file_recovery->calculated_file_size+=2+size;
+ file_recovery->calculated_file_size+=(uint64_t)2+size;
if(buffer[i+1]==0xc0) /* SOF0 */
{
if(jpg_check_sof0(buffer, buffer_size, i)!=0)