-
Notifications
You must be signed in to change notification settings - Fork 173
Description
Certain string matchings fail in c/driver/common/utils.c when trying to find a table by name. A loop iterates through all tables and tries to find a match. The matching code is currently:
if (!strncmp(name.data, table_name, name.size_bytes) { return table; }
name.data is a contiguous buffer of table names, like adbc_pkey_testtest_canceladbc_fkey_test_baseadbc_fkey_testadbc_composite_pk[...]. The table_name (let's say adbc_pkey_test) is now compared to the first name.size_bytes of this buffer, which usually works out. If a non-existing table_name string is composed of an existing table name plus starting characters of another table, a match can be made where there is none. A correctly matching example is:
adbc_pkey_test
adbc_pkey_testtest_canceladbc_fkey_test_baseadbc_fkey_testadbc_composite_pk[...]
^
(compared until here)
An example that matches erroneously is:
adbc_pkey_testtest
adbc_pkey_testtest_canceladbc_fkey_test_baseadbc_fkey_testadbc_composite_pk[...]
^
(compared until here)
N.B.: The tables are returned in nondeterministic order, so this might not fail reliably.
Software version: current main branch 8a832d6