Skip to content

Commit

Permalink
lib: istream-concat - Fix potential hang when reaching max buffer size
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and cmouse committed Oct 29, 2024
1 parent 72a5ef3 commit 2adea4a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib/istream-concat.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ static ssize_t i_stream_concat_read(struct istream_private *stream)
return -2;
}
stream->buffer = stream->w_buffer;
if (size < new_bytes_count) {
/* Everything couldn't be added to the concat-istream's
buffer. However, parent istream still contains data
in its buffer and it might not be receiving more.
Make sure the istream won't hang. */
i_stream_set_input_pending(&stream->istream, TRUE);
}

/* we'll copy all the new input to w_buffer. if we skip over
prev_stream_left bytes, the next read will switch to
Expand Down

0 comments on commit 2adea4a

Please sign in to comment.