Page MenuHome GnuPG

libgpg-error and undefined behavior sanitizer findings
Closed, ResolvedPublic

Description

I'm building libgpg-error 1.38 with -fsanitize=undefined -fno-sanitize-recover=all.

$make check
...
PASS: t-poll
PASS: t-b64
argparse.c:293:22: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
FAIL: t-argparse
argparse.c:293:22: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
FAIL: t-logging
argparse.c:293:22: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
FAIL: t-stringutils
argparse.c:293:22: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
FAIL: t-malloc

Details

Version
1.38

Revisions and Commits

Event Timeline

JW created this object in space S1 Public.

Here's the patch:

--- src/argparse.c
+++ src/argparse.c
@@ -56,7 +56,7 @@
 
 
 /* Hidden argparse flag used to mark the object as initialized.  */
-#define ARGPARSE_FLAG__INITIALIZED  (1<< ((8*SIZEOF_INT)-1))
+#define ARGPARSE_FLAG__INITIALIZED  (1U<< ((8*SIZEOF_INT)-1))
 
 /* Special short options which are auto-inserterd.  Must fit into an
  * unsigned short.  */

If you send an email to GNU's platform-testers mailing list before a release, then the community can help you test the release candidates before the release. A lot of folks will be happy to help with testing. If you use platform-testers, then (1) build a release tarball and give it a *-rc name, (2) provide a URL to download the tarball, and (3) state where you would like bug reports sent (mailing list, bug tracker, etc).

werner claimed this task.
werner added a subscriber: werner.

Thanks