From 13573a6c4bc0311f91371fd4563bc930d4811682 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 29 Mar 2023 20:28:37 -0400 Subject: [PATCH] AK: Refill a BufferedStream when it has less than the requested size We currently only fill a buffer when it is empty. So if it has 1 byte and 16 KB was requested, only that 1 byte would be returned. Instead, attempt to refill the buffer when it's size is less than the requested size. --- AK/BufferedStream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/BufferedStream.h b/AK/BufferedStream.h index ab66e8c78a..c0e9512958 100644 --- a/AK/BufferedStream.h +++ b/AK/BufferedStream.h @@ -67,7 +67,7 @@ public: return buffer; // Fill the internal buffer if it has run dry. - if (m_buffer.used_space() == 0) + if (m_buffer.used_space() < buffer.size()) TRY(populate_read_buffer()); // Let's try to take all we can from the buffer first.