Fix division by 0 in Bitmask::get_ready_prefix_size.

GitOrigin-RevId: c16d3a9a2622d31c3ab186c350d67466e4d99bdc
This commit is contained in:
levlam 2019-03-09 17:31:52 +03:00
parent 347a22858c
commit 87eaeb2db2

View File

@ -52,6 +52,10 @@ int64 Bitmask::get_ready_prefix_size(int64 offset, int64 part_size, int64 file_s
if (offset < 0) { if (offset < 0) {
return 0; return 0;
} }
if (part_size == 0) {
return 0;
}
CHECK(part_size > 0);
auto offset_part = offset / part_size; auto offset_part = offset / part_size;
auto ones = get_ready_parts(offset_part); auto ones = get_ready_parts(offset_part);
if (ones == 0) { if (ones == 0) {