已合并
fix(liveview): CheckNotificationRequest 增加空 content 判空校验防止崩溃 #5012
stepend98创建于 8月25日
fix(liveview): CheckNotificationRequest 增加空 content 判空校验防止崩溃 #5012
已合并
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 stepend98 的贡献)afwk_helper
8月25日 评论:
8月25日 评论:
开始进行AI检视!
AI review has been started, please wait...


afwk_helper
8月25日 评论:
8月25日 评论:
| check type | result | report |
|---|---|---|
| start ai_review | pass | - |


8月25日 修改了pull request 的描述
stepend98
8月25日 评论:
8月25日 评论:
start build


8月25日 添加了label:waiting_on_author
此处折叠了63条消息 查看更多
afwk_helper
9月2日 评论:
9月2日 评论:
9月2日 关闭了关联的issue
9月2日 合入了pull request,合并节点 SHA:c1b90dd8ac3083c65a74af805eb4c2445afdea55
9月2日 删除了label:waiting_for_review
9月2日 添加了label:merged
变更说明
NotificationRequest::CheckNotificationRequest在IsCommonLiveView()返回 true 后直接解引用notificationContent_,未校验指针有效性。IsCommonLiveView()仅比较slotType_和notificationContentType_两个枚举值,不验证notificationContent_是否指向有效对象。触发路径
ReadFromParcel先读取notificationContentType_(LIVE_VIEW 合法),后读取 content 的 valid 标志;valid=false 时不读取 content 对象,notificationContent_保持 nullptr,但反序列化返回 true。后续服务端 publish 流程Filter()→CheckNotificationRequest()触发空指针解引用ConvertJsonToEnum设置类型,ConvertJsonToNotificationContent无 "content" 键时notificationContent_保持 nullptr,同样触发修复内容
CheckNotificationRequest在IsCommonLiveView()通过后增加notificationContent_和内部content_两层判空,返回ERR_ANS_INNER_INVALID_PARAM并记录 bundle/id 日志(与CheckVersion、GetLiveViewStatus既有防御模式一致)兼容性
纯防御性新增,不改变任何合法输入的行为;原本必然崩溃的输入现在返回错误码。
验证
构建通过(
rk3568 build success,0 编译错误,无新增警告)。Fixes #4375