Blob Blame History Raw
Index: gtkwave3/src/helpers/lxt2_read.c
===================================================================
--- gtkwave3/src/helpers/lxt2_read.c	(revision 1)
+++ gtkwave3/src/helpers/lxt2_read.c	(revision 27)
@@ -1507,8 +1507,8 @@
 				off_t fspos = b->filepos;
 				int rc;
 
-				char *zbuff=NULL;
-				int zlen = 0;
+				int zlen = 16;
+				char *zbuff=malloc(zlen);
 				struct z_stream_s strm;
 
 				real_uncompressed_siz = b->uncompressed_siz;
@@ -1544,11 +1544,15 @@
 						strm.next_in = (unsigned char *)(zbuff+10);
 						strm.next_out = (unsigned char *)(pnt);
 
-						rc = inflateInit2(&strm, -MAX_WBITS);
-						while (Z_OK == (rc = inflate(&strm, Z_NO_FLUSH)));
-						rc = inflateEnd(&strm);
-						if(strm.total_out!=unclen)
+						if((clen != 0)&&(unclen != 0))
 							{
+							rc = inflateInit2(&strm, -MAX_WBITS);
+							while (Z_OK == (rc = inflate(&strm, Z_NO_FLUSH)));
+							rc = inflateEnd(&strm);
+							}
+
+						if((strm.total_out!=unclen)||(clen == 0)||(unclen == 0))
+							{
 							fprintf(stderr, LXT2_RDLOAD"short read on subblock %ld vs "LXT2_RD_LD" (exp), ignoring\n", strm.total_out, unclen);
 							free(b->mem); b->mem=NULL;
 							b->short_read_ignore = 1;