diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index 27d0791bd2..8fe56323a3 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -113,7 +113,7 @@ public: // if need buffer reallocation if (tail + bytes > buffers.last().size()) { - if (tail >= basicBlockSize) { + if (tail + bytes > buffers.last().capacity() && tail >= basicBlockSize) { // shrink this buffer to its current size buffers.last().resize(tail);