Skip to content

'NoneType' object is not iterable #2

Description

@nikias

I get this error when trying to use dsc_fix on MobileCoreServices (tried different version, 9.3.3, 10.0.1, 10.0.2, 10.1) directly opened as a 'single image' from the matching dyld_shared_cache_arm64 which I select in the open dialog presented by dsc_fix:

/Users/nikias/coding/dsc_fix/dsc_fix.py: 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/Applications/IDA Pro 6.95/idaq64.app/Contents/MacOS/python/ida_idaapi.py", line 509, in IDAPython_ExecScript
    execfile(script, g)
  File "/Users/nikias/coding/dsc_fix/dsc_fix.py", line 760, in <module>
    main()
  File "/Users/nikias/coding/dsc_fix/dsc_fix.py", line 745, in main
    map_shared_bridges(dsc_file, adrfind)
  File "/Users/nikias/coding/dsc_fix/dsc_fix.py", line 629, in map_shared_bridges
    label_and_fix_branch_islands(dsc_file, adrfind, jmp_to_code)
  File "/Users/nikias/coding/dsc_fix/dsc_fix.py", line 645, in label_and_fix_branch_islands
    dylib_path, dsc_offset, macho_offset = res
TypeError: 'NoneType' object is not iterable

I changed the code to continue anyway like this:

diff --git a/dsc_fix.py b/dsc_fix.py
index 68443f8..e96eabf 100644
--- a/dsc_fix.py
+++ b/dsc_fix.py
@@ -642,6 +642,8 @@ def label_and_fix_branch_islands(dsc_file, adrfind, jmp_to_code):
         res = adrfind.find(addr)
         if not res:
             print "[!] coudln't find addr for addr:", addr
+            i += 1
+            continue
         dylib_path, dsc_offset, macho_offset = res
         exportname = adrfind.get_export_name_for_addr(addr)
         if _IN_IDA:

However in the end, it created the additional segements, but instead of things like B objc_msgSend_0 I see a B loc_<original_address in new segment> that is undefined code, for example something like this:

CPS #0x1F   (hex: 1F 00 00 F1)

Any idea what is wrong here? What is the file you used for your example screenshots so I can try if that works at least?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions