diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-03-14 14:19:03 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-03-14 15:16:04 +0100 |
commit | 1a6a9d6878ed00265941939adc468a517cd5ef36 (patch) | |
tree | 09f6376bcf825f8d92193a9952c1825de952e8e8 | |
parent | f8efa589e886b6910a438d84357d9b5a76ba9ca0 (diff) | |
download | libxml2-1a6a9d6878ed00265941939adc468a517cd5ef36.tar.gz |
xzlib: Fix implicit sign change in xz_open
-rw-r--r-- | xzlib.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -133,6 +133,7 @@ static xzFile xz_open(const char *path, int fd, const char *mode ATTRIBUTE_UNUSED) { xz_statep state; + off_t offset; /* allocate xzFile structure to return */ state = xmlMalloc(sizeof(xz_state)); @@ -167,9 +168,11 @@ xz_open(const char *path, int fd, const char *mode ATTRIBUTE_UNUSED) } /* save the current position for rewinding (only if reading) */ - state->start = lseek(state->fd, 0, SEEK_CUR); - if (state->start == (uint64_t) - 1) + offset = lseek(state->fd, 0, SEEK_CUR); + if (offset == -1) state->start = 0; + else + state->start = offset; /* initialize stream */ xz_reset(state); |