Fix truncation of comparison value introduced in 848acd67
.
Casting the difference of the two off_t values to size_t may truncate the result. Doing so before the comparison will therefore break it. Instead cast the size to off_t to get around the signed versus unsigned integer expression comparison and then cast the result of the comparison to size_t again. Should fix #9714.
This commit is contained in:
parent
32d7bcb470
commit
a064168869
@ -487,7 +487,7 @@ translate_partition_access(devfs_partition* partition, off_t& offset,
|
||||
ASSERT(offset >= 0);
|
||||
ASSERT(offset < partition->info.size);
|
||||
|
||||
size = min_c(size, (size_t)(partition->info.size - offset));
|
||||
size = (size_t)min_c((off_t)size, partition->info.size - offset);
|
||||
offset += partition->info.offset;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user