summaryrefslogtreecommitdiffstats
path: root/tests/jq.test
diff options
context:
space:
mode:
authorEmanuele Torre <torreemanuele6@gmail.com>2023-07-15 08:11:41 +0200
committerNico Williams <nico@cryptonector.com>2023-07-16 00:03:46 -0500
commite79335e3a587d77954face2137fc3d4b5482129e (patch)
treeee8a73e125c76ed695daaa63dfc226300ea1cfd9 /tests/jq.test
parent1cb9ba353320f25549bffbccc1fc7a278dfcaeb1 (diff)
Initialise jq_state->input_cb{,_data} to NULL in jq_init()
To avoid causing segmentation faults when input/1 is called in a jq_state on which jq_set_input_cb() has not been called; e.g. the one used by jq --run-tests. That segfault could also be fixed in run_jq_tests() by calling: jq_set_input_cb(jq, NULL, NULL); But I think it makes sense to just make jq_init() initialise those values to NULL. Ref: https://github.com/jqlang/jq/pull/2717#discussion_r1264338841
Diffstat (limited to 'tests/jq.test')
-rw-r--r--tests/jq.test7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/jq.test b/tests/jq.test
index ebaefdb8..21eabb06 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -1818,3 +1818,10 @@ true
tojson | fromjson
{"a":nan}
{"a":null}
+
+
+# calling input/1 in a test doesn't crash jq
+
+try input catch .
+null
+"break"