[svn] GnuPG - r5144 - trunk/g10

svn author wk cvs at cvs.gnupg.org
Thu Sep 3 13:29:26 CEST 2009


Author: wk
Date: 2009-09-03 13:29:25 +0200 (Thu, 03 Sep 2009)
New Revision: 5144

Modified:
   trunk/g10/ChangeLog
   trunk/g10/compress-bz2.c
Log:
Fix bug#1011.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2009-09-03 10:57:23 UTC (rev 5143)
+++ trunk/g10/ChangeLog	2009-09-03 11:29:25 UTC (rev 5144)
@@ -1,3 +1,8 @@
+2009-09-03  Werner Koch  <wk at g10code.com>
+
+	* compress-bz2.c (do_uncompress): Detect unexpected EOF.  Fix
+	bug#1011.
+
 2009-08-26  Werner Koch  <wk at g10code.com>
 
 	* keyedit.c (menu_revsig): Check for signature right away.  Fix
@@ -191,7 +196,7 @@
 
 	* keygen.c (ask_key_flags): Fix bug in the translation check.
 	Fixes bug#1056.
-	
+
 2009-05-18  Daiki Ueno  <ueno at unixuser.org>  (wk)
 
 	* encode.c (encode_simple): Tell passphrase_to_dek to cache
@@ -826,7 +831,7 @@
 
 	* gpg.c (reopen_std): Moved to ../common and renamed to
 	gnupg_reopen_std.
-	
+
 	* gpg.c: Remove second inclusion of fcntl.h.
 
 2007-11-19  Werner Koch  <wk at g10code.com>
@@ -874,7 +879,7 @@
 	alias to it.  --rfc2440 now stands alone.  For now, use the old
 	2440 defaults for 4880.
 	* misc.c (compliance_option_string): Ditto.
-	
+
 	* keyedit.c (keyedit_menu): Use compliance_option_string() instead
 	of printing the compliance modes here.
 
@@ -888,7 +893,7 @@
 2007-10-25  David Shaw  <dshaw at jabberwocky.com>  (wk)
 
 	From 1.4 (July):
-	
+
 	* armor.c (parse_header_line): Improve test so that the header
 	test only allows "Hash" in the signed data section.
 
@@ -979,7 +984,6 @@
 	* gpg.c, gpgv.c: Include sysutils.h.
 	(main): Replace iobuf_translate_file_handle by
 	translate_sys2libc_fd.
-	
 
 2007-06-21  Werner Koch  <wk at g10code.com>
 
@@ -994,7 +998,7 @@
 
 	* misc.c (setsysinfo, trap_unaligned): Remove.  It is also in
 	common/sysutils.c.
-	(disable_core_dumps, get_session_marker): 
+	(disable_core_dumps, get_session_marker):
 
 	* sign.c (sleep): Remove sleep wrapper.
 

Modified: trunk/g10/compress-bz2.c
===================================================================
--- trunk/g10/compress-bz2.c	2009-09-03 10:57:23 UTC (rev 5143)
+++ trunk/g10/compress-bz2.c	2009-09-03 11:29:25 UTC (rev 5144)
@@ -118,6 +118,7 @@
   size_t n;
   int nread, count;
   int refill = !bzs->avail_in;
+  int eofseen = 0;
 
   if( DBG_FILTER )
     log_debug("begin bzDecompress: avail_in=%u, avail_out=%u, inbuf=%u\n",
@@ -132,13 +133,17 @@
 	    bzs->next_in = zfx->inbuf;
 	  count = zfx->inbufsize - n;
 	  nread = iobuf_read( a, zfx->inbuf + n, count );
-	  if( nread == -1 ) nread = 0;
+	  if( nread == -1 )
+            {
+              eofseen = 1;
+              nread = 0;
+            }
 	  n += nread;
 	  bzs->avail_in = n;
 	}
+      if (!eofseen)
+        refill = 1;
 
-      refill = 1;
-
       if( DBG_FILTER )
 	log_debug("enter bzDecompress: avail_in=%u, avail_out=%u\n",
 		  (unsigned)bzs->avail_in, (unsigned)bzs->avail_out);
@@ -151,6 +156,13 @@
 	rc = -1; /* eof */
       else if( zrc != BZ_OK && zrc != BZ_PARAM_ERROR )
 	log_fatal("bz2lib inflate problem: rc=%d\n", zrc );
+      else if (zrc == BZ_OK && eofseen 
+               && !bzs->avail_in && bzs->avail_out > 0)
+        {
+          log_error ("unexpected EOF in bz2lib\n");
+          rc = GPG_ERR_BAD_DATA;
+          break;
+        }
     }
   while( bzs->avail_out && zrc != BZ_STREAM_END && zrc != BZ_PARAM_ERROR );
 




More information about the Gnupg-commits mailing list