diff --git a/src/core/SkOrderedWriteBuffer.cpp b/src/core/SkOrderedWriteBuffer.cpp index 7db0312ef..de265875d 100644 --- a/src/core/SkOrderedWriteBuffer.cpp +++ b/src/core/SkOrderedWriteBuffer.cpp @@ -132,7 +132,12 @@ void SkOrderedWriteBuffer::writePath(const SkPath& path) { } size_t SkOrderedWriteBuffer::writeStream(SkStream* stream, size_t length) { - return fWriter.readFromStream(stream, length); + fWriter.write32(length); + size_t bytesWritten = fWriter.readFromStream(stream, length); + if (bytesWritten < length) { + fWriter.reservePad(length - bytesWritten); + } + return bytesWritten; } bool SkOrderedWriteBuffer::writeToStream(SkWStream* stream) {