out of memory while allocating 0 bytes

Yamagata Yoriyuki yoriyuki at mbg.sphere.ne.jp
Sat Sep 14 21:08:02 CEST 2002

(Since my post is about a rather technical issue, I post gnupg-devel.
If it is not appropriate, I will move to gnupg-users.  Sorry if it is
a well-known issue.)

I have tried to compile GnuPG 1.0.7 on OSF1 (alphaev6-dec-osf4.0f),
but it fails.

bash-2.03$ make
Making all in checks
No suffix list.
../g10/gpg --homedir . --quiet --yes --import ./pubdemo.asc	 
gpg: out of  memory while allocating 0 bytes
*** Exit 2

I don't give any configure option except prefix.  The problem occurs
when m_alloc is called with the argument n = 0.  Since malloc in this
system returns NULL for the request of 0-byte allocation, this causes
the error.  The backtrace is here.

#0  m_alloc (n=0) at memory.c:425
#1  0x1200188b8 in copy_public_key (d=0x14002d9a0, s=0x14002d720)
    at free-packet.c:167
#2  0x120019d20 in pk_from_block (ctx=0x0, pk=0x0, keyblock=0x14002d7a0)
    at getkey.c:295
#3  0x120019f2c in get_pubkey (pk=0x14002d9a0, keyid=0x11ffff450)
    at getkey.c:356
#4  0x1200572f0 in import_one (fname=0x11ffff9de "pubdemo.asc", 
    keyblock=0x14002ec80, fast=1073928096, stats=0x14002a680) at import.c:472
#5  0x120056550 in import (inp=0x14002e8c0, fast=0, 
    fname=0x11ffff9de "pubdemo.asc", stats=0x14002a680) at import.c:199
#6  0x120056304 in import_keys (fnames=0x11ffff818, nnames=1, fast=0, 
    stats_handle=0x0) at import.c:147
#7  0x120012950 in main (argc=1, argv=0x11ffff818) at g10.c:1851

I am able to compile with --enable-m-guard configure option, but I
don't think this is the supposed use of the option.  Does GnuPG 1.2
fix the problem?
Yamagata Yoriyuki
PGP fingerprint = 0374 5290 7445 4C06 D79E AA86 1A91 48CB 2B4E 34CF

More information about the Gnupg-devel mailing list