1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

gpg: New maintainer option --debug-set-iobuf-size.

* g10/gpg.c (opts): Add new option.
(opt_set_iobuf_size): New var.
(set_debug): Set the option.
* tests/openpgp/armor.scm: Use this option to revert the buffer size
to the one which used to exhibit the tested bugs.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2018-01-24 18:29:08 +01:00
parent bfc1181644
commit db7661b5a2
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
4 changed files with 23 additions and 6 deletions

View File

@ -59,9 +59,7 @@
/*-- Begin configurable part. --*/
/* The size of the internal buffers.
NOTE: If you change this value you MUST also adjust the regression
test "armored_key_8192" in armor.test! */
/* The standard size of the internal buffers. */
#define DEFAULT_IOBUF_BUFFER_SIZE (64*1024)
/* To avoid a potential DoS with compression packets we better limit

View File

@ -2859,6 +2859,12 @@ Set all useful debugging flags.
Set stdout into line buffered mode. This option is only honored when
given on the command line.
@item --debug-set-iobuf-size @var{n}
@opindex debug-iolbf
Change the buffer size of the IOBUFs to @var{n} kilobyte. Using 0
prints the current size. Note well: This is a maintainer only option
and may thus be changed or removed at any time without notice.
@item --faked-system-time @var{epoch}
@opindex faked-system-time
This option is only useful for testing; it sets the system time back or

View File

@ -223,6 +223,7 @@ enum cmd_and_opt_values
oDebugLevel,
oDebugAll,
oDebugIOLBF,
oDebugSetIobufSize,
oStatusFD,
oStatusFile,
oAttributeFD,
@ -642,6 +643,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_s (oDebugLevel, "debug-level", "@"),
ARGPARSE_s_n (oDebugAll, "debug-all", "@"),
ARGPARSE_s_n (oDebugIOLBF, "debug-iolbf", "@"),
ARGPARSE_s_u (oDebugSetIobufSize, "debug-set-iobuf-size", "@"),
ARGPARSE_s_i (oStatusFD, "status-fd", "@"),
ARGPARSE_s_s (oStatusFile, "status-file", "@"),
ARGPARSE_s_i (oAttributeFD, "attribute-fd", "@"),
@ -956,6 +958,8 @@ int g10_errors_seen = 0;
static int utf8_strings = 0;
static int maybe_setuid = 1;
static unsigned int opt_set_iobuf_size;
static unsigned int opt_set_iobuf_size_used;
static char *build_list( const char *text, char letter,
const char *(*mapf)(int), int (*chkf)(int) );
@ -1276,6 +1280,10 @@ set_debug (const char *level)
if (opt.debug)
parse_debug_flag (NULL, &opt.debug, debug_flags);
if (opt_set_iobuf_size || opt_set_iobuf_size_used)
log_debug ("iobuf buffer size is %uk\n",
iobuf_set_buffer_size (opt_set_iobuf_size));
}
@ -2742,6 +2750,11 @@ main (int argc, char **argv)
case oDebugIOLBF: break; /* Already set in pre-parse step. */
case oDebugSetIobufSize:
opt_set_iobuf_size = pargs.r.ret_ulong;
opt_set_iobuf_size_used = 1;
break;
case oStatusFD:
set_status_fd ( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
break;

View File

@ -191,7 +191,7 @@ nW1ff9rt1YcTH9LiiE4EGBECAAYFAjnKLe0AEgkQ3uyMCd5BWw4HZUdQRwABAZeBAKDsa7tc
(info "Checking armored_key_8192")
(pipe:do
(pipe:echo armored_key_8192)
(pipe:gpg '(--import)))
(pipe:gpg '(--debug-set-iobuf-size=8 --import)))
(define nopad_armored_msg "-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.11-svn5139 (GNU/Linux)
@ -758,10 +758,10 @@ wg7Md81a5RI3F2FG8747t9gX
(info "Importing alpha_seckey")
(pipe:do
(pipe:echo alpha_seckey)
(pipe:gpg '(--import)))
(pipe:gpg '(--debug-set-iobuf-size=8 --import)))
(info "Checking for bug #1179")
(tr:do
(tr:pipe-do
(pipe:echo nopad_armored_msg)
(pipe:gpg '(--decrypt))))
(pipe:gpg '(--debug-set-iobuf-size=8 --decrypt))))