summaryrefslogtreecommitdiff
path: root/sci-mathematics/pspp/files/pspp-1.2.0-fix-segfaults.patch
blob: 03b9d00fe73ab96d965f556c45e5afd446ae9150 (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
41
42
43
44
45
Upstream: https://git.savannah.gnu.org/cgit/pspp.git/commit/?id=df8cf077b2aacb7fe7b33dd8cb90ba57c8681aa0

From df8cf077b2aacb7fe7b33dd8cb90ba57c8681aa0 Mon Sep 17 00:00:00 2001
From: John Darrington <john@darrington.wattle.id.au>
Date: Sat, 2 Mar 2019 15:29:39 +0100
Subject: PSPPIRE: Avoid some segmentation faults when corrupt data is
 encountered.

---
 src/ui/gui/psppire-data-store.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c
index f97b8eaf1..3c2765f5d 100644
--- a/src/ui/gui/psppire-data-store.c
+++ b/src/ui/gui/psppire-data-store.c
@@ -183,6 +183,8 @@ psppire_data_store_value_to_string (gpointer unused, PsppireDataStore *store, gi
   g_return_val_if_fail (variable, g_strdup ("???"));
 
   GVariant *vrnt = g_value_get_variant (v);
+  g_return_val_if_fail (vrnt, g_strdup ("???"));
+
   union value val;
   value_variant_get (&val, vrnt);
 
@@ -231,12 +233,14 @@ __get_value (GtkTreeModel *tree_model,
   if (NULL == variable)
     return;
 
-  g_value_init (value, G_TYPE_VARIANT);
-
   gint row = GPOINTER_TO_INT (iter->user_data);
 
   struct ccase *cc = datasheet_get_row (store->datasheet, row);
 
+  g_return_if_fail (cc);
+
+  g_value_init (value, G_TYPE_VARIANT);
+
   const union value *val = case_data_idx (cc, var_get_case_index (variable));
 
   GVariant *vv = value_variant_new (val, var_get_width (variable));
-- 
cgit v1.2.1