summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/gnupg-test-segfault-on-32bit-arch.patch
blob: 79bb41caaa42d46be1d4472a51bb404a2555a652 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
This fixes a segfault on 32-bit architectures. Upstream discussion:

https://lists.gnupg.org/pipermail/gnupg-devel/2016-December/032364.html

Guix thread: https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00631.html

Patch copied from upstream source repository:

https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commitdiff;h=6e96cdd41a0e55b672309431062f37c4a4a9f485

From 6e96cdd41a0e55b672309431062f37c4a4a9f485 Mon Sep 17 00:00:00 2001
From: Justus Winter <justus@g10code.com>
Date: Wed, 21 Dec 2016 16:14:45 +0100
Subject: [PATCH] gpgscm: Guard use of union member.

* tests/gpgscm/scheme.c (opexe_5): Check that we have a file port
before accessing filename.  Fixes a crash on 32-bit architectures.

Fixes-commit: e7429b1ced0c69fa7901f888f8dc25f00fc346a4
Signed-off-by: Justus Winter <justus@g10code.com>
---
 tests/gpgscm/scheme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index a5b7691..2844545 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -4838,7 +4838,7 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) {
                } else {
                     sc->nesting_stack[sc->file_i]++;
 #if USE_TAGS && SHOW_ERROR_LINE
-		    {
+		    if (sc->load_stack[sc->file_i].kind & port_file) {
 		      const char *filename =
 			sc->load_stack[sc->file_i].rep.stdio.filename;
 		      int lineno =
-- 
2.8.0.rc3