aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorMichael Santos <[email protected]>2011-04-07 08:41:00 -0400
committerHenrik Nord <[email protected]>2011-04-07 15:18:28 +0200
commitb9e8506d802d7548e5573af5d38513a44ea7f8bd (patch)
tree6674dc94e8bd5b1d9ddcf4eeb56cafe7689eb9fb /erts/emulator
parent67bea716bb708e9fe49d9934e656928f68b8f49f (diff)
downloadotp-b9e8506d802d7548e5573af5d38513a44ea7f8bd.tar.gz
otp-b9e8506d802d7548e5573af5d38513a44ea7f8bd.tar.bz2
otp-b9e8506d802d7548e5573af5d38513a44ea7f8bd.zip
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
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/drivers/common/gzio.c2
1 files changed, 2 insertions, 0 deletions
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;