Page MenuHome GnuPG

Compressed data packets with uncompressed data (algo=0)
Closed, ResolvedPublic

Description

It seems there is a bug in the current version of GPG2 (2.0.17) that prevents it
from uncompressing compressed data packets with uncompressed data:

$ gpg2 --list-packets compressed.pgp
:compressed packet: algo=0
gpg: uncompressing failed: Unknown compression algorithm

I have tracked the problem down to an erroneous if in g10/mainproc.c. Patch
below:

  • gnupg-2.0.17/g10/mainproc.c 2011-01-09 22:06:16.000000000 +0000

+++ gnupg-2.0.17_patched/g10/mainproc.c 2011-03-18 12:11:35.000000000 +0000
@@ -771,9 +771,7 @@

int rc;

/*printf("zip: compressed data packet\n");*/
  • if( !zd->algorithm )
  • rc=G10ERR_COMPR_ALGO;
  • else if( c->sigs_only )

+ if( c->sigs_only )
rc = handle_compressed( c, zd, proc_compressed_cb, c );

else if( c->encrypt_only )

rc = handle_compressed( c, zd, proc_encrypt_cb, c );

By removing that incorrect if statement, gpg2 now correctly handles uncompressed
data.
Note that the if statement is clearly incorrect, the uncompressed algorithm
value is 0 so it would always return an error, and checking for a correct
compression algorithm is already done in the handle_compressed function.

After removing that if, gpg2 correctly handles this data:

$ gpg2 --list-packets compressed.pgp
:compressed packet: algo=0
:literal data packet:
mode u (75), created 3188556365, name="",
raw data: 12 bytes

Hope that you can include this simple patch in an upcoming release.

Details

Version
2.0.17

Event Timeline

werner added a subscriber: werner.

Fixed for 2.0.19 (88633bf3).

Thanks.

werner claimed this task.
werner removed a project: Restricted Project.