Closed moralismercatus closed 9 years ago
Sample:
int main(int argc, char* argv[]) { (void)argc; (void)argv; int64_t tv; char timestr[12]; int duration = 1; FILE* file = fopen("input.data", "r"); assert(file); assert(fread(×tr[0], 1, sizeof(timestr), file) == sizeof(timestr)); assert(fread(&duration, 1, sizeof(int), file) == sizeof(int)); av_parse_time(&tv, timestr, duration); printf("%-24s -> %-21"PRIi64"\n", timestr, tv); return 0; }
With:
<file path="input.data" virtual="true" size="16"/>
The 3rd assertion fails. When the size="17", the assertion does not fail. As 12+4=16, a file of size 16 bytes should work correctly here, but it appears to be off by one.
Fixed. There was a bug in my implementation of fread for calculating the number of bytes to read.
Sample:
With:
The 3rd assertion fails. When the size="17", the assertion does not fail. As 12+4=16, a file of size 16 bytes should work correctly here, but it appears to be off by one.