Add null checks to prevent SIGSEGV when table lookup fails#4116
Open
rachavz wants to merge 14 commits intosqlitebrowser:masterfrom
Open
Add null checks to prevent SIGSEGV when table lookup fails#4116rachavz wants to merge 14 commits intosqlitebrowser:masterfrom
rachavz wants to merge 14 commits intosqlitebrowser:masterfrom
Conversation
By default word wrap for QTableView is enabled. If cell's text include quated string or colon or dash (like date: 2025-09-01 00:00:01) then text truncated too much. For example instead of "2005-09-01 00:00:..." truncate to "2005-09-01..."
Fix virtual table sql file export typo
- switch option to positive logic - invoke unconditional setWordWrap()
Fix elide mode behaviour
docs(metainfo): add more URLs
Given that sqlite3 does not allow case-differing identifiers, and in some situations the stored name in `schemata` may differ only in case from the name used in the stored SQL create statement, the search of DB objects must be done case-insensitively. See issue sqlitebrowser#4110.
This adds a new setting in "Preferences > Database" (defaulting to false) to watch the database file when opened in read-only mode and refresh the browser on updated file. See issues sqlitebrowser#1767 and sqlitebrowser#2508.
Added option to replace non-alphanumeric characters in column name with underscore. SQL editor does not complete correctly column names containing space, column and etc.
Replace non-alphanumeric with underscore
The query_logger lambda is called via Qt::QueuedConnection, so editor content may have changed by the time it executes. This caused Scintilla assertion failures when from_position/to_position exceeded document length, or when line numbers were out of bounds after conversion. - Clamp from_position/to_position with qBound before use - Clamp line indices against actual line lengths before setErrorIndicator - Call finishExecution on early return when editor is empty - Guard line iteration loops with lines boundary check Fixes sqlitebrowser#4109.
When a table name stored in sqlite_master differs in case from the name in the CREATE TABLE statement (e.g. databases created by Turso), the getTableByName lookup could return a null TablePtr. Multiple call sites dereferenced the result without checking for null, causing SIGSEGV crashes. This complements the case-insensitive lookup fix (commit 222e430) by adding defensive null checks at all remaining unprotected call sites in the browse data path and related operations. Fixes sqlitebrowser#4110
9bc0dc4 to
f6242b6
Compare
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.
Summary
getTableByName()result was dereferenced without protection, preventing SIGSEGV crashesDetails
Issue #4110 reports a SIGSEGV when browsing a table whose name in
sqlite_masterdiffers in case from the name in itsCREATE TABLEstatement (e.g. databases created by Turso). While commit 222e430 addressed the root cause with case-insensitive lookups, there were still 8 unprotected call sites where a nullTablePtrwould crash the application.Fixed crash sites
sqlitetablemodel.cpp:134setQuery()->isView()and->fieldsTableBrowser.cpp:899applyViewportSettings()->isView()TableBrowser.cpp:992generateFilters()getFieldNumber()TableBrowser.cpp:1450editDisplayFormat()->fields.at()TableBrowser.cpp:1551copyColumnName()->fields.at()sqlitedb.cpp:1336getRow()->rowidColumns()sqlitedb.cpp:1378max()->primaryKeyColumns()sqlitedb.cpp:1792alterTable()*getTableByName(...)Fixes #4110