0 | |
From: Daniel Scharrer <daniel@constexpr.org>
|
1 | |
Date: Fri, 2 Nov 2018 08:58:25 +0100
|
2 | |
Subject: Fix support for slices larger than 2 GiB in 32-bit
|
3 | |
|
4 | |
---
|
5 | |
CHANGELOG | 5 +++++
|
6 | |
src/stream/slice.cpp | 8 +++++---
|
7 | |
2 files changed, 10 insertions(+), 3 deletions(-)
|
8 | |
|
9 | |
diff --git a/CHANGELOG b/CHANGELOG
|
10 | |
index 20d27f0..ea9faac 100644
|
11 | |
--- a/CHANGELOG
|
12 | |
+++ b/CHANGELOG
|
13 | |
@@ -1,4 +1,9 @@
|
14 | |
|
15 | |
+innoextract 1.8 (WIP)
|
16 | |
+ - Added support for installers using an alternative setup loader magic
|
17 | |
+ - Added support for using boost_{zlib,bzip2} when statically linking Boost
|
18 | |
+ - Fixed extracting files from slices larger than 2 GiB with 32-bit builds
|
19 | |
+
|
20 | |
innoextract 1.7 (2018-06-12)
|
21 | |
- Added support for Inno Setup 5.6.0 installers
|
22 | |
- Added support for new GOG installers with GOG Galaxy file parts
|
23 | |
diff --git a/src/stream/slice.cpp b/src/stream/slice.cpp
|
24 | |
index c4b3372..4ed2637 100644
|
25 | |
--- a/src/stream/slice.cpp
|
26 | |
+++ b/src/stream/slice.cpp
|
27 | |
@@ -231,17 +231,19 @@ std::streamsize slice_reader::read(char * buffer, std::streamsize bytes) {
|
28 | |
if(read_pos > slice_size) {
|
29 | |
break;
|
30 | |
}
|
31 | |
- std::streamsize remaining = std::streamsize(slice_size - read_pos);
|
32 | |
+ boost::uint32_t remaining = slice_size - read_pos;
|
33 | |
if(!remaining) {
|
34 | |
seek(current_slice + 1);
|
35 | |
read_pos = boost::uint32_t(is->tellg());
|
36 | |
if(read_pos > slice_size) {
|
37 | |
break;
|
38 | |
}
|
39 | |
- remaining = std::streamsize(slice_size - read_pos);
|
40 | |
+ remaining = slice_size - read_pos;
|
41 | |
}
|
42 | |
|
43 | |
- if(is->read(buffer, std::min(remaining, bytes)).fail()) {
|
44 | |
+ boost::uint64_t toread = std::min(boost::uint64_t(remaining), boost::uint64_t(bytes));
|
45 | |
+ toread = std::min(toread, boost::uint64_t(std::numeric_limits<std::streamsize>::max()));
|
46 | |
+ if(is->read(buffer, std::streamsize(toread)).fail()) {
|
47 | |
break;
|
48 | |
}
|
49 | |
|