Asan findings in tests/t-logging.c
Open, NormalPublic

Description

Hi Everyone,

I'm performing a Asan run on GnuPG 2.2.15 and all of its dependencies. Everything was built with -fsanitize=address -fno-omit-frame-pointer. For Autotools projects the two flags get placed in CFLAGS, CXXFLAGS and LDFLAGS.

It looks likeAsan is producing multiple findings in gpgerror's tests/t-logging.c. It looks like logbuf is not being free'd before calling fail or die.

Attached is an updated t-logging.c that cleans up before exiting. It avoids the false positives so the build can continue.

Related Objects

JW created this task.May 10 2019, 11:34 PM
JW created this object in space S1 Public.
gniibe claimed this task.May 14 2019, 4:42 AM
gniibe triaged this task as Normal priority.
gniibe edited projects, added gpgrt; removed gnupg.
gniibe added a subscriber: gniibe.

Thanks for your report.
Let me handle issue by issue.

There are multiple problems; memory leak on failure path and memory leak on success path.

IIUC, it is not a problem of die/fail with non-freed logbuf, but a leak of logbuf on success path.

I'm fixing success path leakage.