Home GnuPG

tests: avoid write-beyond-end-of-heap buffer
377ff84d2187Unpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

tests: avoid write-beyond-end-of-heap buffer

In libgcrypt's "make check" (latest from git), I was surprised to
see the "basic" test fail. Here's a patch:

Avoid scary-looking (with MALLOC_CHECK_=3) "make check" test failure:

  • glibc detected * /h/j/w/co/libgcrypt/tests/.libs/lt-basic: free(): invalid pointer: 0x0000000001f9d080 * ======= Backtrace: ========= /lib64/libc.so.6[0x3a5807c606] /w/libgcrypt/src/.libs/libgcrypt.so.19(+0x100c9)[0x7f890edb90c9] /w/libgcrypt/src/.libs/libgcrypt.so.19(+0xb03e)[0x7f890edb403e] /w/libgcrypt/src/.libs/libgcrypt.so.19(gcry_free+0x18)[0x7f890edb1eef] /w/libgcrypt/tests/.libs/lt-basic[0x4091f4] /w/libgcrypt/tests/.libs/lt-basic[0x40b541] /lib64/libc.so.6(__libc_start_main+0xed)[0x3a5802169d] /w/libgcrypt/tests/.libs/lt-basic[0x401979] ======= Memory map: ======== 00400000-00411000 r-xp 00000000 08:08 2787510 /w/co/libgcrypt/tests/.libs/lt-basic ...

From 722e6d470371bb3d995e0a6a67cd9c2ffd7bb664 Mon Sep 17 00:00:00 2001

From: Jim Meyering <meyering@redhat.com>
Date: Fri, 11 Nov 2011 11:34:45 +0100
Subject: [PATCH] tests: avoid write-beyond-end-of-heap buffer

  • basic.c (check_bulk_cipher_modes): Allocate one more byte in

each of the two test buffers. Otherwise, running
"env -i MALLOC_CHECK_=3 ./basic" would abort.

Details

Provenance
meyeringAuthored on Nov 11 2011, 11:38 AM
wernerCommitted on Nov 11 2011, 4:03 PM
Parents
rCba7127721035: Factor cipher mode code out to separate files.
Branches
Unknown
Tags
Unknown

Event Timeline

Werner Koch <wk@gnupg.org> committed rC377ff84d2187: tests: avoid write-beyond-end-of-heap buffer (authored by Jim Meyering <jim@meyering.net>).Nov 11 2011, 4:03 PM