Skip to content

Compare InsertData rows against both datasets regardless of block boundaries - #576

Open
Hakaou wants to merge 1 commit into
ClickHouse:masterfrom
Hakaou:insert-data-expected-rows
Open

Hakaou wants to merge 1 commit into
ClickHouse:masterfrom
Hakaou:insert-data-expected-rows

Conversation

@Hakaou

@Hakaou Hakaou commented Oct 17, 2026

Copy link
Copy Markdown

Noticed while running the client suite under UBSan for #575.

InsertData inserts two blocks of four rows, then checks the selected rows with a branch on which block is being read, indexing TEST_DATA with the running row number. When the server returns the eight rows in a single block, the first branch runs for all eight rows and reads TEST_DATA[4..7], past the array:

client_ut.cpp:625:21: runtime error: index 4 out of bounds for type 'const struct (unnamed struct)[4]'
client_ut.cpp:626:21: runtime error: index 4 out of bounds ...
client_ut.cpp:627:21: runtime error: index 4 out of bounds ...

The values matched only because TEST_DATA2 happened to follow TEST_DATA in memory, which nothing guarantees.

Change: the two anonymous structs become one Row, the expectation is the concatenation of both datasets, and every received row is compared against it with ASSERT_LT(row, expected.size()) instead of the branch. Block boundaries no longer matter.

Checked locally against ClickHouse 26.11.1 (macOS arm64): the test passes under AddressSanitizer and UBSan with halt_on_error=1, and the whole ClientCase suite stays green.

…ndaries

The expectation branched on which block was being read and indexed
TEST_DATA with the running row number. When the server returns the
eight rows in one block, that reads past TEST_DATA (UBSan: index 4 out
of bounds, client_ut.cpp:625-627); the values matched only because
TEST_DATA2 happened to follow it in memory.
@CLAassistant

CLAassistant commented Oct 17, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants