Skip to content

Commit 76c0784

Browse files
committed
More compilation fixes
1 parent 33ac084 commit 76c0784

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/api/Compressor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ int CDECL initCompressor(struct cData* pData, FILE* dst, struct cContext** pCtx)
144144
cctx->fos = fos;
145145
*pCtx = cctx;
146146
}
147-
catch (const exception& e) {
147+
catch (const exception&) {
148148
if (fos != nullptr)
149149
delete fos;
150150

src/api/Compressor.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ limitations under the License.
2424
#endif
2525

2626
#include <stdio.h>
27-
#include <stdint.h>
2827

2928

3029
#ifdef __cplusplus

src/api/Decompressor.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,16 @@ namespace kanzi {
5757

5858
if (putback > 4) putback = 4;
5959

60+
// Prevent reading before buffer start
61+
const char* src = gptr() - putback;
62+
63+
if (src < _buffer) {
64+
putback = int(gptr() - _buffer);
65+
src = _buffer;
66+
}
67+
6068
// Move putback characters to start of buffer
61-
std::memmove(_buffer + (4 - putback), gptr() - putback, putback);
69+
std::memmove(_buffer + (4 - putback), src, putback);
6270

6371
// Read new characters into buffer
6472
const int n = int(READ(_fd, _buffer + 4, BUF_SIZE - 4));

0 commit comments

Comments
 (0)