Re: Feature request: limit file size or skip file
Posted: 21 Dec 2023, 22:19
Hmm, I spotted a possible issue while reading the code.
In file_riff.c it reads
165 file_size = next_fs;
166 /* align to word boundary */
167 file_size = (file_size&1);
Is this last line correct? I see a bitwise and with 1 here so after this files_size will be 0 or 1
Shouldn't this line read:
file_size = (file_size&~1);
if rounding down is desired or
file_size = ((file_size+1)&~1);
if we want to round up.
(so add 1 if rounding up is desired and instead of anding with 1 and with not 1)
As testing takes 10.5 hr I'd rather get some feedback before actually attempting to make this change.
@cgrenier what is your opinion?
EDIT: after this I figured that I of course set a breakpoint at this line, examine file_size; skip the line, then set file_size to the value obtained just before.
The breakpoint was hit a few times and afterwards it continued and I got an avi file recovered.
Triggered by this I decided to make the change in this code and - lo and behold - recovering continues.
I did notice a small UI issue after recovering though.
The estimated time to completion is very short; see attachment.
I suspect this is due to taking the time from the very first sector to the sector we are and then estimate based on the remaining number of sectors.
However probably we need to take the number of sectors that were read since recovery and calculate based upon that.
In file_riff.c it reads
165 file_size = next_fs;
166 /* align to word boundary */
167 file_size = (file_size&1);
Is this last line correct? I see a bitwise and with 1 here so after this files_size will be 0 or 1
Shouldn't this line read:
file_size = (file_size&~1);
if rounding down is desired or
file_size = ((file_size+1)&~1);
if we want to round up.
(so add 1 if rounding up is desired and instead of anding with 1 and with not 1)
As testing takes 10.5 hr I'd rather get some feedback before actually attempting to make this change.
@cgrenier what is your opinion?
EDIT: after this I figured that I of course set a breakpoint at this line, examine file_size; skip the line, then set file_size to the value obtained just before.
The breakpoint was hit a few times and afterwards it continued and I got an avi file recovered.
Triggered by this I decided to make the change in this code and - lo and behold - recovering continues.
I did notice a small UI issue after recovering though.
The estimated time to completion is very short; see attachment.
I suspect this is due to taking the time from the very first sector to the sector we are and then estimate based on the remaining number of sectors.
However probably we need to take the number of sectors that were read since recovery and calculate based upon that.