Repository navigation
fix: resolve QList out-of-bounds access in showDeviceInfo - #869
Merged
deepin-bot[bot] merged 1 commit intoOct 26, 2026
Merged
Conversation
1. Root cause: when lstInfo contains nullptr entries, the nullptr filter skips them without calling addWidgets(), but the separator index used lstInfo.size()-1 instead of the actual separator count 2. Fix: replace m_ListDetailSeperator[lstInfo.size()-1] with m_ListDetailSeperator.last() since addWidgets() just appended it 3. Impact: prevents crash when device list mixes nullptr and valid devices, no behavior change for all-valid-device lists Log: Fixed crash when device list contains null entries Influence: 1. Test device detail view with mixed null and valid device entries 2. Verify no crash when device list contains nullptr items 3. Test device detail view with all-valid-device list for regression fix: 修复showDeviceInfo中QList越界访问导致崩溃 1. 根因:当设备列表lstInfo包含nullptr项时,空指针过滤跳过这些项 不调用addWidgets(),但分隔符索引仍使用lstInfo.size()-1而非 实际分隔符数量,导致越界访问 2. 方案:将m_ListDetailSeperator[lstInfo.size()-1]替换为 m_ListDetailSeperator.last(),因为addWidgets()刚追加了该分隔符 3. 影响:防止设备列表混有nullptr和有效设备时的崩溃,对全有效设备 列表无行为变化 Log: 修复设备列表包含空指针项时设备详情页崩溃的问题 Influence: 1. 测试设备列表混有空指针和有效设备时设备详情页显示 2. 验证设备列表包含nullptr项时不崩溃 3. 测试全有效设备列表场景确认无回归 PMS: BUG-DM-DEF-001
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes a crash in showDeviceInfo when null and valid device entries are mixed by targeting the separator actually appended for the last valid device, while preserving behavior for lists containing only valid devices. Sequence diagram for safe device detail renderingsequenceDiagram
participant PageDetail
participant DeviceList as DeviceList
participant Separators as Separators
PageDetail->>DeviceList: showDeviceInfo(lstInfo)
loop each device
alt device is nullptr
PageDetail->>PageDetail: skip device
else device is valid
PageDetail->>PageDetail: addWidgets()
PageDetail->>Separators: last()->setVisible(false)
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例本报告由 AI 代码审查工具自动生成 |
lzwind
approved these changes
Oct 26, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind 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 |
Contributor
Author
|
/merge |
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.
fix: resolve QList out-of-bounds access in showDeviceInfo
filter skips them without calling addWidgets(), but the separator
index used lstInfo.size()-1 instead of the actual separator count
m_ListDetailSeperator.last() since addWidgets() just appended it
devices, no behavior change for all-valid-device lists
Log: Fixed crash when device list contains null entries
Influence:
fix: 修复showDeviceInfo中QList越界访问导致崩溃
不调用addWidgets(),但分隔符索引仍使用lstInfo.size()-1而非
实际分隔符数量,导致越界访问
m_ListDetailSeperator.last(),因为addWidgets()刚追加了该分隔符
列表无行为变化
Log: 修复设备列表包含空指针项时设备详情页崩溃的问题
Influence:
PMS: BUG-DM-DEF-001
Summary by Sourcery
Bug Fixes: