gpgme C++ missing returns in non-void functions

Andreas Stieger astieger at suse.com
Wed Sep 21 14:40:14 CEST 2016


Hello,

I would like to flag up four issues that are in the new C++ code in
gpgme 1.7.0:

lang/cpp/src/context.cpp :: Context::signaturePolicyURL()

https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=blob;f=lang/cpp/src/context.cpp;h=00f397b477665292f65786289bdc89bd85db4bc9;hb=e7ab75379feadcc2894d9d4cde0f16ad0044780d#l1047

There is a control path where there is no return in a non-void function.

lang/cpp/src/context.cpp :: to_tofu_policy_t()

https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=blob;f=lang/cpp/src/context.cpp;h=00f397b477665292f65786289bdc89bd85db4bc9;hb=e7ab75379feadcc2894d9d4cde0f16ad0044780d#l1333

Same, missing default case or catchall return.

lang/cpp/src/key.cpp :: Key::primaryFingerprint()

https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=blob;f=lang/cpp/src/key.cpp;h=cfa1ba3156b3f8a749f99c7a899a9f40c16772d2;hb=e7ab75379feadcc2894d9d4cde0f16ad0044780d#l263

There is a control path where there is no return in a non-void function.

lang/cpp/src/tofuinfo.cpp :: GpgME::TofuInfo::policy()

https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=blob;f=lang/cpp/src/tofuinfo.cpp;h=bb67fc8cd6b2a5c72bc8ff4da16fdb6cd0f57660;hb=e7ab75379feadcc2894d9d4cde0f16ad0044780d#l95

Same, missing default case or catchall return.

Patch attached, or pull from below.

The following changes since commit e7ab75379feadcc2894d9d4cde0f16ad0044780d:

  Release 1.7.0 (2016-09-21 09:18:01 +0200)

are available in the git repository at:

  https://github.com/andreasstieger/gpgme.git

for you to fetch changes up to 643dbabc0df78e6e1bf0a04d1e2dd666f5f308a2:

  cpp : Avoid missing returns in non-void functions (2016-09-21 14:28:23
+0200)

----------------------------------------------------------------
Andreas Stieger (1):
      cpp : Avoid missing returns in non-void functions

 lang/cpp/src/context.cpp  | 2 ++
 lang/cpp/src/key.cpp      | 1 +
 lang/cpp/src/tofuinfo.cpp | 1 +
 3 files changed, 4 insertions(+)

Andreas


-- 
Andreas Stieger <astieger at suse.com>
Project Manager Security
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton,
HRB 21284 (AG Nürnberg)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cpp-Avoid-missing-returns-in-non-void-functions.patch
Type: text/x-patch
Size: 2136 bytes
Desc: not available
URL: </pipermail/attachments/20160921/9afca1ae/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20160921/9afca1ae/attachment-0001.sig>


More information about the Gnupg-devel mailing list