Patch Fix-incorrect-buffer_size-calculation-with-streams for rar Bug #76592
Patch version 2018-07-06 23:58 UTC
Return to Bug #76592 |
Download this patch
Patch Revisions:
Developer: magrodriguez93@gmail.com
From caeaea175b5a277dd196dd7755a58c438b21096c Mon Sep 17 00:00:00 2001
From: Magdiel Rodriguez <magrodriguez93@gmail.com>
Date: Fri, 6 Jul 2018 18:26:27 -0500
Subject: [PATCH] Fix incorrect buffer_size calculation with streams.
If the unpacked size was bigger than RAR_CHUNK_BUFFER_SIZE,
then buffer_size would always be RAR_CHUNK_BUFFER_SIZE.
---
rar_stream.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/rar_stream.c b/rar_stream.c
index ed2be60..29a6907 100644
--- a/rar_stream.c
+++ b/rar_stream.c
@@ -509,9 +509,8 @@ php_stream *php_stream_rar_open(char *arc_name,
else {
/* no need to allocate a buffer bigger than the file uncomp size */
size_t buffer_size = (size_t)
- MIN((uint64) RAR_CHUNK_BUFFER_SIZE,
- INT32TO64(self->header_data.UnpSizeHigh,
- self->header_data.UnpSize));
+ INT32TO64(self->header_data.UnpSizeHigh, self->header_data.UnpSize);
+
int process_result = RARProcessFileChunkInit(self->rar_handle);
if (_rar_handle_error(process_result TSRMLS_CC) == FAILURE) {
--
2.18.0
|