I stumbled upon a minor valgrind warning when testing a SSL change:

==16783== Conditional jump or move depends on uninitialised value(s)
==16783==    at 0x44E662: http_res_get_intercept_rule (proto_http.c:3730)
==16783==    by 0x44E662: http_process_res_common (proto_http.c:6528)
==16783==    by 0x4797B7: process_stream (stream.c:1851)
==16783==    by 0x414634: process_runnable_tasks (task.c:238)
==16783==    by 0x40B02F: run_poll_loop (haproxy.c:1528)
==16783==    by 0x407F25: main (haproxy.c:1887)

It looks like it's currently possible for the current_rule field to be
evaluated before being set, probably since commit
152b81e7b2565862956af883820d4f79177d0651.

-- 
Remi
From 99895c9786558d159ab35e0dde30123cc7633cab Mon Sep 17 00:00:00 2001
From: Remi Gacogne <[email protected]>
Date: Wed, 22 Jul 2015 17:10:58 +0200
Subject: [PATCH] MINOR: stream: initialize the current_rule field to NULL on
 stream init

Currently it is possible for the current_rule field to be evaluated before
being set, leading to valgrind complaining:

==16783== Conditional jump or move depends on uninitialised value(s)
==16783==    at 0x44E662: http_res_get_intercept_rule (proto_http.c:3730)
==16783==    by 0x44E662: http_process_res_common (proto_http.c:6528)
==16783==    by 0x4797B7: process_stream (stream.c:1851)
==16783==    by 0x414634: process_runnable_tasks (task.c:238)
==16783==    by 0x40B02F: run_poll_loop (haproxy.c:1528)
==16783==    by 0x407F25: main (haproxy.c:1887)

This was introduced by commit 152b81e7b2565862956af883820d4f79177d0651.
---
 src/stream.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/stream.c b/src/stream.c
index ff6b32b..e6f1fc6 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -105,6 +105,7 @@ struct stream *stream_new(struct session *sess, struct task *t, enum obj_type *o
 	 * any rulelist match the NULL pointer.
 	 */
 	s->current_rule_list = NULL;
+	s->current_rule = NULL;
 
 	memset(s->stkctr, 0, sizeof(s->stkctr));
 
-- 
2.4.6

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to