Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging API allows for trivial segfaulting usage #289

Open
jnpkrn opened this issue Jan 19, 2018 · 0 comments
Open

Logging API allows for trivial segfaulting usage #289

jnpkrn opened this issue Jan 19, 2018 · 0 comments

Comments

@jnpkrn
Copy link
Contributor

jnpkrn commented Jan 19, 2018

git apply <<EOF
diff --git a/examples/simplelog.c b/examples/simplelog.c
index eec0053..33c5f7b 100644
--- a/examples/simplelog.c
+++ b/examples/simplelog.c
@@ -210,7 +210,7 @@ main(int32_t argc, char *argv[])
 		qb_log_filter_ctl(QB_LOG_BLACKBOX, QB_LOG_FILTER_ADD,
 				  QB_LOG_FILTER_FILE, "*", LOG_DEBUG);
 		qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_SIZE, 4096);
-		qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_THREADED, QB_FALSE);
+		qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_THREADED, do_threaded);
 		qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_TRUE);
 	}
 	if (logfile) {
@@ -247,7 +247,7 @@ main(int32_t argc, char *argv[])
 		qb_log(LOG_ERR, "no syslog");
 	}
 
-	if (do_blackbox) {
+	if (do_blackbox && 0) {
 		logfile = NULL;
 		logfile[5] = 'a';
 	} else {
EOF
make simplelog
./simplelog -bt

resulting in

Ringbuffer: 
 ->OVERWRITE
 ->write_pt [0]
 ->read_pt [0]
 ->size [2048 words]
 =>free [8192 bytes]
 =>used [0 bytes]
Segmentation fault (core dumped)

(No, this time it's not intended case that's currently neutralized.)

It depends on further investigation how much thread-safe ringbuffer implementation actually is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant