Skip to content

Commit

Permalink
stored: fix droplet truncation bug
Browse files Browse the repository at this point in the history
(cherry picked from commit ce304f3)
  • Loading branch information
arogge committed Aug 26, 2021
1 parent 0cb66db commit d58fb03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/stored/backends/chunked_device.cc
Expand Up @@ -824,7 +824,7 @@ ssize_t chunked_device::ReadChunked(int fd, void* buffer, size_t count)
/*
* See how much is left in this chunk.
*/
if (offset_ < current_chunk_->end_offset) {
if (offset_ <= current_chunk_->end_offset) {
wanted_offset = (offset_ % current_chunk_->chunk_size);
bytes_left = MIN((ssize_t)(count - offset),
(ssize_t)(current_chunk_->buflen - wanted_offset));
Expand Down Expand Up @@ -960,7 +960,7 @@ ssize_t chunked_device::WriteChunked(int fd, const void* buffer, size_t count)
/*
* See how much is left in this chunk.
*/
if (offset_ < current_chunk_->end_offset) {
if (offset_ <= current_chunk_->end_offset) {
wanted_offset = (offset_ % current_chunk_->chunk_size);
bytes_left =
MIN((ssize_t)(count - offset),
Expand Down

0 comments on commit d58fb03

Please sign in to comment.