[PATCH 0/6] Memory leaks and undefined behavior fixes

Peter Wu peter at lekensteyn.nl
Thu Jul 9 17:11:30 CEST 2015


Here are some small patches which fixes memory leaks and undefined
behavior (copying from/to a NULL buffer). These were caught by running
the test suite with ASAN and ubsan enabled.

There is also a patch to the commit-msg hook such that it does not
complain for the diff in `git commit -v`.

The "Add LSan annotation to ignore a memory leak" patch "works" in the
sense that the memory leak gets ignored.

Finally there is a patch to clarify the RSA secret calculation. This was
the original reason why I dug into the libgcrypt code. (I suspected a
bug in this code, but it turns out that Wireshark had an issue by
passing u = q^-1 mod p in the private key instead of u = p^-1 mod q.)

Kind regards,

Peter Wu (6):
  sexp: fix invalid deallocation in error path
  ecc: fix memory leak
  build: ignore scissor line for the commit-msg hook
  Fix undefined behavior wrt memcpy
  Add LSan annotation to ignore a memory leak
  rsa: clarify the RSA secret parameters

 build-aux/git-hooks/commit-msg |  6 ++++++
 cipher/cipher-gcm.c            |  2 +-
 cipher/ecc.c                   |  1 +
 cipher/mac-poly1305.c          |  3 +++
 cipher/rsa.c                   |  9 +++++++--
 mpi/mpiutil.c                  |  5 ++++-
 src/g10lib.h                   | 17 +++++++++++++++++
 src/sexp.c                     |  2 +-
 8 files changed, 40 insertions(+), 5 deletions(-)


More information about the Gcrypt-devel mailing list