1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Initialise jq_state->debug_cb{,_data} to NULL

To make debug/0 not call an uninitialised function pointer when using
--run-tests or when using a jq_state on which jq_set_debug_cb() has not
been called.
This commit is contained in:
Emanuele Torre
2023-07-18 06:49:25 +02:00
committed by Nico Williams
parent 9e4c71558a
commit bb0f898c01
2 changed files with 8 additions and 1 deletions

View File

@@ -1015,6 +1015,9 @@ jq_state *jq_init(void) {
jq->input_cb = NULL;
jq->input_cb_data = NULL;
jq->debug_cb = NULL;
jq->debug_cb_data = NULL;
jq->err_cb = default_err_cb;
jq->err_cb_data = stderr;

View File

@@ -1820,8 +1820,12 @@ tojson | fromjson
{"a":null}
# calling input/1 in a test doesn't crash jq
# calling input/0, or debug/0 in a test doesn't crash jq
try input catch .
null
"break"
debug
1
1