| 342 | } |
| 343 | |
| 344 | Status ValidateWriteRange(int64_t offset, int64_t size, int64_t file_size) { |
| 345 | if (offset < 0 || size < 0) { |
| 346 | return Status::Invalid("Invalid write (offset = ", offset, ", size = ", size, ")"); |
| 347 | } |
| 348 | if (offset + size > file_size) { |
| 349 | return Status::IOError("Write out of bounds (offset = ", offset, ", size = ", size, |
| 350 | ") in file of size ", file_size); |
| 351 | } |
| 352 | return Status::OK(); |
| 353 | } |
| 354 | |
| 355 | Status ValidateRange(int64_t offset, int64_t size) { |
| 356 | if (offset < 0 || size < 0) { |