已关闭
aptool dump在ABC文件不匹配时静默失败或崩溃 #10437
zhu_heng创建于  3月17日关闭于  6月15日
zhu_heng
zhu_heng
3月17日 创建

问题描述

aptool dump 命令在使用 --abc-path 参数时存在两个问题:

问题1:ABC文件名不匹配时静默失败

当 profile 中记录的 panda 文件名与 --abc-path 提供的 ABC 文件路径不匹配时(规范化路径和 basename 都对不上),FindRecordByName 返回 nullptr,但没有任何日志输出。用户看到 dump 结果中缺少 class_descriptor 和 method_signature,却不知道原因。

问题2:错误的ABC文件导致崩溃(signal 11)

当用户提供了一个文件名匹配但内容不对应的 ABC 文件时(例如将 entry.abc 重命名为 modules.abc),FindRecordByName 通过 basename 匹配成功,但 profile 中的 method index 指向了错误文件中的非法位置,导致 MethodDataAccessor / ProtoDataAccessor 读取垃圾数据,引发 SIGSEGV 崩溃。

根因分析

  1. FindRecordByName 在返回 nullptr 时缺少 WARNING 日志
  2. GetMethodInfo 中 ContainsMethod 检查被注释为"允许不在索引中的方法",未起到防护作用
  3. BuildMethodSignature 中对 nameId、protoId 缺少越界检查
  4. GetOrCreateMethodCodeView 中同样缺少 ContainsMethod 防护和 codeId 越界检查
likedislike
openharmony_ci
openharmony_ci成员
3月17日 评论:

感谢提交Issue!关于Issue的交互操作,请访问OpenHarmony社区支持命令清单。如果有问题,请联系 [@weng-changcheng](https://gitcode.com/weng-changcheng) [@godmiaozi](https://gitcode.com/godmiaozi) [@liyiming13](https://gitcode.com/liyiming13) [@lijin1039](https://gitcode.com/lijin1039) [@Prof](https://gitcode.com/Prof) [@dingding5](https://gitcode.com/dingding5) [@vpukhov](https://gitcode.com/vpukhov) [@v-cherkashin](https://gitcode.com/v-cherkashin) 。如果需要调整订阅PR、Issue的变更状态,请访问链接。


Thanks for submitting the issue. For more commands, please visit OpenHarmony Command List. If you have any questions, please refer to committer gitcode for help. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ciopenharmony_ci成员
3月17日 添加了label:waiting_for_assign
zhu_hengzhu_heng
3月17日 关联了pull request:fix(aptool): add defensive checks for ABC metadata lookup
zhu_hengzhu_heng
6月15日 issue状态由 待办的 改变为 已完成
zhu_hengzhu_heng
6月15日 关闭了 issue