Skip to content

Commit

Permalink
stored: fix droplet truncation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
arogge committed Aug 26, 2021
1 parent 0ec05df commit ce304f3
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 @@ -729,7 +729,7 @@ ssize_t ChunkedDevice::ReadChunked(int fd, void* buffer, size_t count)
*/
while (retval < (ssize_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 @@ -855,7 +855,7 @@ ssize_t ChunkedDevice::WriteChunked(int fd, const void* buffer, size_t count)
*/
while (retval < (ssize_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 ce304f3

Please sign in to comment.