Fix NULL dereference in fetchSQLiteTableStructure() on error#84149
Merged
azat merged 1 commit intoClickHouse:masterfrom Jul 21, 2025
Merged
Fix NULL dereference in fetchSQLiteTableStructure() on error#84149azat merged 1 commit intoClickHouse:masterfrom
azat merged 1 commit intoClickHouse:masterfrom
Conversation
CI found [1]:
BaseDaemon: Address: NULL pointer. Access: read. Address not mapped to object.
BaseDaemon: Stack trace: 0x00007f33b5ad70bd 0x000055ce7dfba161 0x000055ce89bb8061 0x000055ce8d2c1e18 0x000055ce8d2c1967 0x000055ce8d2c43a4 0x000055ce8d2c31e5 0x000055ce8d0434bb 0x000055ce8a883b5d 0x000055ce8a87c7b0 0x000055ce8a88971c 0x000055ce8ac3c88d 0x000055ce8ac3fd67 0x000055ce8a78351c 0x000055ce8a78160c 0x000055ce8a77ec62 0x000055ce8a777eff 0x000055ce8a793c26 0x000055ce84acc360 0x000055ce84ad217b 0x00007f33b59b9ac3 0x00007f33b5a4b850
BaseDaemon: 3. ? @ 0x00000000001b20bd
BaseDaemon: 4. String::basic_string[abi:ne190107]<0>(char const*) @ 0x0000000008e0b161
BaseDaemon: 5. ./ci/tmp/build/./src/Databases/SQLite/fetchSQLiteTableStructure.cpp:89: DB::fetchSQLiteTableStructure(sqlite3*, String const&) @ 0x0000000014a09061
BaseDaemon: 6. ./ci/tmp/build/./src/Storages/StorageSQLite.cpp:85: DB::StorageSQLite::getTableStructureFromData(std::shared_ptr<sqlite3> const&, String const&) @ 0x0000000018112e18
BaseDaemon: 7. ./ci/tmp/build/./src/Storages/StorageSQLite.cpp:69: DB::StorageSQLite::StorageSQLite(DB::StorageID const&, std::shared_ptr<sqlite3>, String const&, String const&, DB::ColumnsDescription const&, DB::ConstraintsDescription const&, String const&, std::shared_ptr<DB::Context const>) @ 0x0000000018112967
[1]: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=84112&sha=d21d30e30689009ff84e4339423bac1dccf950a2&name_0=PR&name_1=Stateless%20tests%20%28amd_binary%2C%20old%20analyzer%2C%20s3%20storage%2C%20DatabaseReplicated%2C%20sequential%29
Contributor
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a critical NULL pointer dereference vulnerability in the fetchSQLiteTableStructure() function. The CI detected a segmentation fault where the code was attempting to construct a String object from a potentially NULL err_message pointer returned by SQLite operations.
- Adds NULL pointer check before constructing error message string
- Provides fallback error message when SQLite doesn't return specific error details
serxa
approved these changes
Jul 21, 2025
Member
Author
|
Merged
via the queue into
ClickHouse:master
with commit Jul 21, 2025
f92a35a
122 of 124 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI found 1:
Changelog category (leave one):