|
|
bacbc8 |
From 9c9034a8cb88de406c64553d27f6471f99b9e06a Mon Sep 17 00:00:00 2001
|
|
|
bacbc8 |
From: Florian Westphal <fw@strlen.de>
|
|
|
bacbc8 |
Date: Mon, 4 Mar 2019 01:06:05 +0100
|
|
|
bacbc8 |
Subject: [PATCH] segtree: fix crash when debug mode is active
|
|
|
bacbc8 |
MIME-Version: 1.0
|
|
|
bacbc8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
bacbc8 |
Content-Transfer-Encoding: 8bit
|
|
|
bacbc8 |
|
|
|
bacbc8 |
We must set output_fp to sensible filep, else crash.
|
|
|
bacbc8 |
|
|
|
bacbc8 |
Reported-by: Václav Zindulka <vaclav.zindulka@tlapnet.cz>
|
|
|
bacbc8 |
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
bacbc8 |
(cherry picked from commit afd1ad6f68680c0f0a4afad7c67ddc8652948732)
|
|
|
bacbc8 |
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
|
bacbc8 |
---
|
|
|
bacbc8 |
src/segtree.c | 7 +++++--
|
|
|
bacbc8 |
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
bacbc8 |
|
|
|
bacbc8 |
diff --git a/src/segtree.c b/src/segtree.c
|
|
|
bacbc8 |
index 5685618b3724a..5a5a728912db7 100644
|
|
|
bacbc8 |
--- a/src/segtree.c
|
|
|
bacbc8 |
+++ b/src/segtree.c
|
|
|
bacbc8 |
@@ -9,6 +9,7 @@
|
|
|
bacbc8 |
*/
|
|
|
bacbc8 |
|
|
|
bacbc8 |
#include <stdlib.h>
|
|
|
bacbc8 |
+#include <string.h>
|
|
|
bacbc8 |
#include <inttypes.h>
|
|
|
bacbc8 |
#include <arpa/inet.h>
|
|
|
bacbc8 |
|
|
|
bacbc8 |
@@ -67,8 +68,6 @@ struct elementary_interval {
|
|
|
bacbc8 |
struct expr *expr;
|
|
|
bacbc8 |
};
|
|
|
bacbc8 |
|
|
|
bacbc8 |
-static struct output_ctx debug_octx = {};
|
|
|
bacbc8 |
-
|
|
|
bacbc8 |
static void seg_tree_init(struct seg_tree *tree, const struct set *set,
|
|
|
bacbc8 |
struct expr *init, unsigned int debug_mask)
|
|
|
bacbc8 |
{
|
|
|
bacbc8 |
@@ -570,6 +569,7 @@ int set_to_intervals(struct list_head *errs, struct set *set,
|
|
|
bacbc8 |
bool merge)
|
|
|
bacbc8 |
{
|
|
|
bacbc8 |
struct elementary_interval *ei, *next;
|
|
|
bacbc8 |
+ struct output_ctx debug_octx;
|
|
|
bacbc8 |
struct seg_tree tree;
|
|
|
bacbc8 |
LIST_HEAD(list);
|
|
|
bacbc8 |
|
|
|
bacbc8 |
@@ -590,6 +590,9 @@ int set_to_intervals(struct list_head *errs, struct set *set,
|
|
|
bacbc8 |
}
|
|
|
bacbc8 |
|
|
|
bacbc8 |
if (segtree_debug(tree.debug_mask)) {
|
|
|
bacbc8 |
+ memset(&debug_octx, 0, sizeof(debug_octx));
|
|
|
bacbc8 |
+ debug_octx.output_fp = stderr;
|
|
|
bacbc8 |
+ debug_octx.error_fp = stderr;
|
|
|
bacbc8 |
expr_print(init, &debug_octx);
|
|
|
bacbc8 |
pr_gmp_debug("\n");
|
|
|
bacbc8 |
}
|
|
|
bacbc8 |
--
|
|
|
bacbc8 |
2.21.0
|
|
|
bacbc8 |
|