| 307 | } |
| 308 | |
| 309 | Status ValidateWriteRange(int64_t offset, int64_t size, int64_t file_size) { |
| 310 | if (offset < 0 || size < 0) { |
| 311 | return Status::Invalid("Invalid write (offset = ", offset, ", size = ", size, ")"); |
| 312 | } |
| 313 | if (offset + size > file_size) { |
| 314 | return Status::IOError("Write out of bounds (offset = ", offset, ", size = ", size, |
| 315 | ") in file of size ", file_size); |
| 316 | } |
| 317 | return Status::OK(); |
| 318 | } |
| 319 | |
| 320 | Status ValidateRange(int64_t offset, int64_t size) { |
| 321 | if (offset < 0 || size < 0) { |