From b9e8506d802d7548e5573af5d38513a44ea7f8bd Mon Sep 17 00:00:00 2001 From: Michael Santos Date: Thu, 7 Apr 2011 08:41:00 -0400 Subject: file: fix hang reading compressed files The gzio driver goes into an infinite loop when reading past the end of a compressed file. Reported-By: Alex Morarash --- erts/emulator/drivers/common/gzio.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'erts/emulator/drivers') diff --git a/erts/emulator/drivers/common/gzio.c b/erts/emulator/drivers/common/gzio.c index 5531a275ea..741cb6ae20 100644 --- a/erts/emulator/drivers/common/gzio.c +++ b/erts/emulator/drivers/common/gzio.c @@ -632,6 +632,7 @@ erts_gzseek(gzFile file, int offset, int whence) while (s->position < pos) { char buf[512]; int n; + int save_pos = s->position; n = pos - s->position; if (n > sizeof(buf)) @@ -643,6 +644,7 @@ erts_gzseek(gzFile file, int offset, int whence) memset(buf, '\0', n); erts_gzwrite(file, buf, n); } + if (save_pos == s->position) break; } return s->position; -- cgit v1.2.3