Skip to content

Commit

Permalink
fix(core-clp): Handle 0-byte reads when BufferReader's underlying b…
Browse files Browse the repository at this point in the history
…uffer is fully consumed. (#687)
  • Loading branch information
LinZhihao-723 authored Jan 22, 2025
1 parent 0c00a94 commit 66067d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/core/src/clp/BufferReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ auto BufferReader::try_read(char* buf, size_t num_bytes_to_read, size_t& num_byt

auto remaining_data_size = get_remaining_data_size();
if (0 == remaining_data_size) {
if (0 == num_bytes_to_read) {
num_bytes_read = 0;
return ErrorCode_Success;
}
return ErrorCode_EndOfFile;
}

Expand Down

0 comments on commit 66067d6

Please sign in to comment.