Type resolution can give surprisingly different results for local variables in similar code
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- objective-c
- Lĩnh vực
- reverse-engineering
Hướng nghiên cứu
Reproduce the discrepancy using the attached good and bad binaries, switch to HLIL at 0x100000890, and apply the shown _objc_msgSendSuper2 call type override. Compare how obj_3 is resolved, including the objc_retain call at 0x100000918. Done means both cases resolve obj_3 as MyClass* after the override, rather than leaving bad at id.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version and Platform (required):
- Binary Ninja Version: 5.2.8236-dev Ultimate, d8af0ff0
- OS: macos
- OS Version: 26.0
- CPU Architecture: arm64
Bug Description:
While working on applying more type information from Objective-C binaries I noticed that the type resolution algorithm gives different results in code that is very similar. Specifically, in cases when the return type of a function that is used to initialize a variable and a function to which the variable is passed have a) different types and b) the same confidence, the function parameter type can end up taking precedence over the return type. This can give the effect of a call type adjustment not being applied.
Whether the return type or later parameter type ends up being selected for the local variable's type depends on the order the algorithm traverses the basic blocks and their edges.
Steps To Reproduce:
- Open both
goodandbad. Switch to HLIL and go to0x100000890. - Right-click on the call to
_objc_msgSendSuper2and add a call type override to:MyClass* _objc_msgSendSuper2(struct objc_super* super, SEL sel)
Expected Behavior:
The type of the local variable obj_3 should update to MyClass* to reflect the new type information.
good behaves as expected.
In bad it stays at id as the type information from the objc_retain call at 0x100000918 is seen first. Since it has the same full confidence as the return type of the call type override, it ends up being used.
Workaround:
Apply a type to the local variable.
Binaries:
These can be built from this source file (call-type-override.m by doing:
cc -DBAD -o bad -fobjc-arc -framework Foundation -Os call-type-override.m
cc -UBAD -o good -fobjc-arc -framework Foundation -Os call-type-override.m
The only difference between them is if (!a || !b || !c) becomes if (!a && !b && !c)
- Ngôn ngữ chính
- C++
- Star
- 1.3k
- Fork
- 298
- Merge trung bình
- 5 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 19
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Vector35/binaryninja-api
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Vector35/binaryninja-api#8540 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Vector35/binaryninja-api#8516 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Vector35/binaryninja-api#8503 ·
-
normalize time logs from WARP Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Vector35/binaryninja-api#8446 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Vector35/binaryninja-api#8444 ·
Tất cả issue của Vector35/binaryninja-api
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
autowarefoundation/autoware_universe#13413 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
automated-analysis bug memory-safety
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
gazebosim/gz-sensors#662 · 1 bình luận ·