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 3c7eab1 commit 2f20d72
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 @@ -836,7 +836,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 @@ -966,7 +966,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),
(ssize_t)((current_chunk_->end_offset - (current_chunk_->start_offset + wanted_offset)) + 1));
Expand Down

0 comments on commit 2f20d72

Please sign in to comment.