Permalink
Browse files

Fixed a segfault when doing an empty gzip.deflate

  • Loading branch information...
1 parent d2a9c3b commit f27af24cf8b2e4a275623aa70ff0b65958e9cb96 @waveto committed Jan 14, 2010
Showing with 5 additions and 6 deletions.
  1. +5 −6 compress.cc
View
@@ -45,13 +45,13 @@ class Gzip : public EventEmitter {
char* temp;
int i=1;
- if (data_len == 0)
- return 0;
-
*out = NULL;
*out_len = 0;
ret = 0;
+ if (data_len == 0)
+ return 0;
+
while(data_len>0) {
if (data_len>CHUNK) {
strm.avail_in = CHUNK;
@@ -244,12 +244,11 @@ class Gunzip : public EventEmitter {
char* temp;
int i=1;
- if (data_len == 0)
- return 0;
-
*out = NULL;
*out_len = 0;
+ if (data_len == 0)
+ return 0;
while(data_len>0) {
if (data_len>CHUNK) {

0 comments on commit f27af24

Please sign in to comment.