fix(reader): guard null annotation and event pointers - #400
Conversation
- check the annotation pointer first in BrowserPage::removeAllAnnotation so a null entry from the renderer cannot be dereferenced by contents()/boundary() - null-check the event before testing its type in SheetBrowser::gestureEvent handling
There was a problem hiding this comment.
Sorry @pengfeixx, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 1 day and 23 hours by commenting @sourcery-ai review. Upgrade to get a review now.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds null-pointer guards in annotation removal and gesture-event dispatch, preventing dereferences of null annotation or event pointers while preserving existing handling for valid objects. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, pengfeixx 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 |
deepin pr auto reviewAI 代码审查报告
总体评价
漏洞统计
漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个 四维度评分维度1:语法逻辑(25/25 ✓)
维度2:代码质量(25/25 ✓)
维度3:代码性能(20/20 ✓)
维度4:代码安全(30/30 ✓)
修改文件详情reader/browser/BrowserPage.cpp函数:
- if (!m_annotations.contains(annota) || (annota && annota->contents().isEmpty()))
+ if (!annota || !m_annotations.contains(annota) || annota->contents().isEmpty())分析:原代码中 reader/browser/SheetBrowser.cpp函数:
- if (event->type() == QEvent::Gesture) {
+ if (event && event->type() == QEvent::Gesture) {分析:原代码直接解引用 审查结论本次 PR 为精准的空指针守卫修复,修改范围极小(2处、各1行),与提交信息 |
Combines #395 and #397 into a single commit (disjoint files, same content):
The two original PRs will be closed in favor of this one.
Summary by Sourcery
Guard annotation and event processing against null pointers to improve reader stability.
Bug Fixes: