Repository navigation
fix(tabbar): guard out-of-range index in fuzz cases - #740
deepin-bot[bot] merged 1 commit into
Conversation
Reviewer's GuideImplementationGuard tab updates and removals against invalid indices before accessing the tab-path list.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/controls/tabbar.cpp" line_range="318" />
<code_context>
<< "file:" << QFileInfo(filePath).fileName()
<< "new name:" << tabName;
+
+ if (index < 0 || index >= m_tabPaths.count()) {
+ qCWarning(appLog) << "Invalid index for updateTab:" << index;
+ return;
</code_context>
<issue_to_address>
**Save-as paths become inconsistent**
When a wrapper remains registered under its old path but that path is absent from the tab bar, `updateTab()` returns without changing the tab, while `Window::updateSaveAsFileName()` and `Window::updateSabeAsFileNameTemp()` continue changing the wrapper path and map key, leaving the tab on the old path and its wrapper on the new one.
Have `updateTab()` report failure and make both save-as callers avoid rekeying the wrapper unless the tab update succeeds.
Also at `src/controls/tabbar.cpp:320`.
</issue_to_address>| << "file:" << QFileInfo(filePath).fileName() | ||
| << "new name:" << tabName; | ||
|
|
||
| if (index < 0 || index >= m_tabPaths.count()) { |
There was a problem hiding this comment.
🟡 Medium · Save-as paths become inconsistent
When a wrapper remains registered under its old path but that path is absent from the tab bar, updateTab() returns without changing the tab, while Window::updateSaveAsFileName() and Window::updateSabeAsFileNameTemp() continue changing the wrapper path and map key, leaving the tab on the old path and its wrapper on the new one.
Have updateTab() report failure and make both save-as callers avoid rekeying the wrapper unless the tab update succeeds.
Also at src/controls/tabbar.cpp:320.
Prompt for AI agents
In `src/controls/tabbar.cpp` at line 318:
**Save-as paths become inconsistent**
When a wrapper remains registered under its old path but that path is absent from the tab bar, `updateTab()` returns without changing the tab, while `Window::updateSaveAsFileName()` and `Window::updateSabeAsFileNameTemp()` continue changing the wrapper path and map key, leaving the tab on the old path and its wrapper on the new one.
Have `updateTab()` report failure and make both save-as callers avoid rekeying the wrapper unless the tab update succeeds.
Also at `src/controls/tabbar.cpp:320`.- Add bounds check in Tabbar::updateTab() before writing m_tabPaths/m_tabTruePaths to fix CWE-787 out-of-bounds write - Add bounds check in Tabbar::handleTabIsRemoved() before reading m_tabPaths.at() to fix CWE-125 out-of-bounds read 修复(tabbar): 修复模糊测试发现的越界索引问题 - Tabbar::updateTab() 写入 m_tabPaths/m_tabTruePaths 前增加越界校验,修复 CWE-787 越界写 - Tabbar::handleTabIsRemoved() 读取 m_tabPaths.at() 前增加越界校验,修复 CWE-125 越界读 Log: 修复安全专项模糊测试发现的标签栏越界写与越界读问题(data()/tabSizeHint() 两处已在先前提交中带防护) Bug: https://pms.uniontech.com/bug-view-383519.html PMS: BUG-383519
c4fef7e to
30dddca
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, pppanghu77 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
修复(tabbar): 修复模糊测试发现的越界索引问题
Log: 修复安全专项模糊测试发现的标签栏越界写与越界读问题
Bug: https://pms.uniontech.com/bug-view-383519.html
PMS: BUG-383519
改动内容 / Changes
验证 / Verification
Summary by Sourcery
Guard tab operations against invalid indices to eliminate fuzzing-discovered out-of-bounds access vulnerabilities.
Bug Fixes: