query.c:5430:16: runtime error: load of value 190, which is not a valid value for type '_Bool'
This was originally reported in https://gitlab.isc.org/isc-private/bind-qa/-/issues/38#note_189030.
When AddressSanitizer constraint from libns unit tests are dropped, query_test
produces runtime error:
[==========] Running 4 test(s).
[ RUN ] ns__query_sfcache_test
[ OK ] ns__query_sfcache_test
[ RUN ] ns__query_start_test
[ OK ] ns__query_start_test
[ RUN ] ns__query_hookasync_test
[ OK ] ns__query_hookasync_test
[ RUN ] ns__query_hookasync_e2e_test
query.c:5430:16: runtime error: load of value 190, which is not a valid value for type '_Bool'
[ OK ] ns__query_hookasync_e2e_test
[==========] 4 test(s) run.
[ PASSED ] 4 test(s).
PASS query_test (exit status: 0)
This is what @michal suggests at https://gitlab.isc.org/isc-private/bind-qa/-/issues/38#note_189274:
This error is a nice catch by ASAN because 190 is
0xbe
in hex. The error is triggered because thechecknames
field ofstruct dns_view
is not initialized bydns_view_create()
. This is a workaround forlib/ns/tests/query_test.c
:diff --git a/lib/ns/tests/query_test.c b/lib/ns/tests/query_test.c index 972a2c2cb4..6da01c9291 100644 --- a/lib/ns/tests/query_test.c +++ b/lib/ns/tests/query_test.c @@ -1412,6 +1412,7 @@ run_hookasync_e2e_test(const ns__query_hookasync_e2e_test_params_t *test) { qctx->client->sendcb = send_noop; /* Load a zone. it should have ns.foo/A */ + qctx->client->view->checknames = true; result = ns_test_serve_zone("foo", "testdata/query/foo.db", qctx->client->view); INSIST(result == ISC_R_SUCCESS);
However, I would also consider an alternative approach: adding
view->checknames = false;
todns_view_create()
. I have not tested that, though. Note that the default0xbe
value means that a check forview->checknames
(which is supposed to be a boolean) would evaluate totrue
rather thanfalse
.