Skip to content

Commit 631c894

Browse files
committed
adding a way to remove unbound growth
1 parent 5c16cc1 commit 631c894

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/aws-cpp-sdk-core/include/smithy/client/features/ChunkingInterceptor.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ class AwsChunkedStreamBuf : public std::streambuf {
7979
m_chunkingBuffer.data() + m_chunkingBufferPos + bytesToRead);
8080

8181
m_chunkingBufferPos += bytesToRead;
82+
83+
// Remove consumed data to prevent unbounded growth
84+
if (m_chunkingBufferPos > DataBufferSize) {
85+
m_chunkingBuffer.erase(m_chunkingBuffer.begin(), m_chunkingBuffer.begin() + m_chunkingBufferPos);
86+
m_chunkingBufferPos = 0;
87+
}
88+
8289
return traits_type::to_int_type(*gptr());
8390
}
8491

0 commit comments

Comments
 (0)