[Pkg-gnupg-commit] [gnupg2] 77/118: gpgscm: Fix detection of unbalanced parenthesis.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 15 18:25:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch encoding-and-speling
in repository gnupg2.

commit f2249b737055f84842778285bbeff5e61fa55225
Author: Justus Winter <justus at g10code.com>
Date:   Tue Sep 6 16:35:40 2016 +0200

    gpgscm: Fix detection of unbalanced parenthesis.
    
    * tests/gpgscm/main.c (load): Print error message.
    * tests/gpgscm/scheme.c (opexe_0): Correctly report nesting level when
    loading files.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 tests/gpgscm/main.c   | 8 ++++++++
 tests/gpgscm/scheme.c | 1 +
 2 files changed, 9 insertions(+)

diff --git a/tests/gpgscm/main.c b/tests/gpgscm/main.c
index 34ebb9f..9aef1f3 100644
--- a/tests/gpgscm/main.c
+++ b/tests/gpgscm/main.c
@@ -32,6 +32,7 @@
 
 #include "private.h"
 #include "scheme.h"
+#include "scheme-private.h"
 #include "ffi.h"
 #include "i18n.h"
 #include "../../common/argparse.h"
@@ -176,6 +177,13 @@ load (scheme *sc, char *file_name,
   scheme_load_named_file (sc, h, qualified_name);
   fclose (h);
 
+  if (sc->retcode)
+    {
+      if (sc->nesting)
+        fprintf (stderr, "%s: Unbalanced parenthesis\n", qualified_name);
+      return gpg_error (GPG_ERR_GENERAL);
+    }
+
   if (file_name != qualified_name)
     free (qualified_name);
   return 0;
diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index 987f5af..1fc7643 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -2592,6 +2592,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
        if(sc->file_i == 0)
          {
            sc->args=sc->NIL;
+           sc->nesting = sc->nesting_stack[0];
            s_goto(sc,OP_QUIT);
          }
        else

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list