Commit 6cd79bec authored by Simon Struk's avatar Simon Struk

Fix overflow in PackedInputStream.

parent 10771d3a
...@@ -140,7 +140,7 @@ size_t PackedInputStream::tryRead(void* dst, size_t minBytes, size_t maxBytes) { ...@@ -140,7 +140,7 @@ size_t PackedInputStream::tryRead(void* dst, size_t minBytes, size_t maxBytes) {
return out - reinterpret_cast<uint8_t*>(dst); return out - reinterpret_cast<uint8_t*>(dst);
} }
uint inRemaining = BUFFER_REMAINING; size_t inRemaining = BUFFER_REMAINING;
if (inRemaining >= runLength) { if (inRemaining >= runLength) {
// Fast path. // Fast path.
memcpy(out, in, runLength); memcpy(out, in, runLength);
...@@ -266,7 +266,7 @@ void PackedInputStream::skip(size_t bytes) { ...@@ -266,7 +266,7 @@ void PackedInputStream::skip(size_t bytes) {
bytes -= runLength; bytes -= runLength;
uint inRemaining = BUFFER_REMAINING; size_t inRemaining = BUFFER_REMAINING;
if (inRemaining > runLength) { if (inRemaining > runLength) {
// Fast path. // Fast path.
in += runLength; in += runLength;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment