1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-12 09:17:37 +03:00

xzlib: Fix implicit sign change in xz_open

This commit is contained in:
Nick Wellnhofer 2023-03-14 14:19:03 +01:00
parent f8efa589e8
commit 1a6a9d6878

View File

@ -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);