libimobiledevice / libplist

A library to handle Apple Property List format in binary or XML
https://libimobiledevice.org
GNU Lesser General Public License v2.1
532 stars 304 forks source link

SIGSEGV (Address boundary error) when trying to import plist with python #187

Open James-Hudson3010 opened 3 years ago

James-Hudson3010 commented 3 years ago

I built libplist with the python bindings and when I try to import it, it crashes.

My simple script is:

import sys
sys.path.append( "/Users/jamesh/tmp/local/lib/python3.8/site-packages" )
import plist

without the path append, python tells me the module is not found.

to create the Makefile, I used ./autogen.sh --prefix=/Users/jamesh/tmp/local --enable-debug

A crash report is generated:

Process:               python3.8 [23412]
Path:                  /Users/USER/*/python3.8
Identifier:            python3.8
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        fish [1678]
Responsible:           iTerm2 [756]
User ID:               392896106

Date/Time:             2021-02-16 15:20:22.419 -0500
OS Version:            Mac OS X 10.15.7 (19H15)
Report Version:        12
Bridge OS Version:     4.6 (17P6610)
Anonymous UUID:        8E3B21A8-8D15-444C-80E2-A2B325DAED33

Time Awake Since Boot: 450000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000008
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [23412]

VM Regions Near 0x8:
--> 
    __TEXT                 00000001017dc000-0000000101a24000 [ 2336K] r-x/r-x SM=COW  /Users/USER/*/*.8

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   plist.so                        0x0000000101e800b0 PyTuple_New + 240 (tupleobject.c:134)
1   plist.so                        0x0000000101e83034 PyType_Ready + 324 (typeobject.c:5311)
2   plist.so                        0x0000000101e82fb2 PyType_Ready + 194 (typeobject.c:5290)
3   plist.so                        0x0000000101e6f619 PyModuleDef_Init + 25 (moduleobject.c:46)
4   python                          0x000000010190a4a5 _PyImport_LoadDynamicModuleWithSpec + 613
5   python                          0x0000000101909d50 _imp_create_dynamic + 336
6   python                          0x000000010183c421 cfunction_vectorcall_FASTCALL + 177
7   python                          0x00000001017fdbc4 PyVectorcall_Call + 100
8   python                          0x00000001018da777 _PyEval_EvalFrameDefault + 31095
9   python                          0x00000001018dec07 _PyEval_EvalCodeWithName + 3287
10  python                          0x00000001017fe3ad _PyFunction_Vectorcall + 253
11  python                          0x00000001018ddb82 call_function + 354
12  python                          0x00000001018da256 _PyEval_EvalFrameDefault + 29782
13  python                          0x00000001017fe22d function_code_fastcall + 237
14  python                          0x00000001018ddb82 call_function + 354
15  python                          0x00000001018da239 _PyEval_EvalFrameDefault + 29753
16  python                          0x00000001017fe22d function_code_fastcall + 237
17  python                          0x00000001018ddb82 call_function + 354
18  python                          0x00000001018da30a _PyEval_EvalFrameDefault + 29962
19  python                          0x00000001017fe22d function_code_fastcall + 237
20  python                          0x00000001018ddb82 call_function + 354
21  python                          0x00000001018da30a _PyEval_EvalFrameDefault + 29962
22  python                          0x00000001017fe22d function_code_fastcall + 237
23  python                          0x00000001018ddb82 call_function + 354
24  python                          0x00000001018da30a _PyEval_EvalFrameDefault + 29962
25  python                          0x00000001017fe22d function_code_fastcall + 237
26  python                          0x00000001017ffc5b object_vacall + 459
27  python                          0x00000001017ffe93 _PyObject_CallMethodIdObjArgs + 227
28  python                          0x0000000101908c38 PyImport_ImportModuleLevelObject + 1800
29  python                          0x00000001018d88ad _PyEval_EvalFrameDefault + 23213
30  python                          0x00000001018dec07 _PyEval_EvalCodeWithName + 3287
31  python                          0x00000001018d2d60 PyEval_EvalCode + 48
32  python                          0x0000000101923903 PyRun_FileExFlags + 291
33  python                          0x0000000101922d6f PyRun_SimpleFileExFlags + 271
34  python                          0x0000000101942243 Py_RunMain + 2147
35  python                          0x0000000101942753 pymain_main + 403
36  python                          0x00000001019427ab Py_BytesMain + 43
37  libdyld.dylib                   0x00007fff673f6cc9 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00000001021cd030  rbx: 0x00000001021cd040  rcx: 0x0000000000000000  rdx: 0x00007f95aec30650
  rdi: 0x0000000102079a80  rsi: 0x00000001021ce000  rbp: 0x00007ffeee422030  rsp: 0x00007ffeee422020
   r8: 0x00000000ffffffff   r9: 0x0000000000000000  r10: 0x0000000000001002  r11: 0x0000000000000202
  r12: 0x0000000101dda470  r13: 0x0000000101d5f190  r14: 0x0000000000000000  r15: 0x0000000101d58240
  rip: 0x0000000101e800b0  rfl: 0x0000000000010202  cr2: 0x0000000000000008

Logical CPU:     6
Error Code:      0x00000004 (no mapping for user data read)
Trap Number:     14

Binary Images:
       0x1017dc000 -        0x101a23ffb +python (0) <60FFF0A9-3433-3B55-8524-740C26397BCB> /Users/USER/*/python
       0x101b64000 -        0x101b6dfff +libintl.8.dylib (0) <FA921CC0-395B-3155-8259-EA61DE25C5D2> /usr/local/opt/gettext/lib/libintl.8.dylib
       0x101d9d000 -        0x101da0ffb +_heapq.cpython-38-darwin.so (0) <01546360-BE95-38A8-AB08-1ECBA7EFA3FB> /Users/USER/*/_heapq.cpython-38-darwin.so
       0x101ded000 -        0x102058ff3 +plist.so (0) <DC0905B1-C828-318B-B6DE-3F4D4D14223E> /Users/USER/*/plist.so
       0x1021ad000 -        0x1021bcff3 +libplist-2.0.3.dylib (0) <2DB2DDEF-309B-3A52-A761-2272673D7D13> /Users/USER/*/libplist-2.0.3.dylib
       0x10eebf000 -        0x10ef50f47  dyld (750.6) <1D318D60-C9B0-3511-BE9C-82AFD2EF930D> /usr/lib/dyld
    0x7fff2d2bc000 -     0x7fff2d73bfeb  com.apple.CoreFoundation (6.9 - 1677.104) <C0D70026-EDBE-3CBD-B317-367CF4F1C92F> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff63f05000 -     0x7fff63f07ff7  libDiagnosticMessagesClient.dylib (112) <C94F3B7B-1854-38EB-9778-834501C53B3F> /usr/lib/libDiagnosticMessagesClient.dylib
    0x7fff643db000 -     0x7fff643dcfff  libSystem.B.dylib (1281.100.1) <0A6C8BA1-30FD-3D10-83FD-FF29E221AFFE> /usr/lib/libSystem.B.dylib
    0x7fff646c1000 -     0x7fff64713fff  libc++.1.dylib (902.1) <59A8239F-C28A-3B59-B8FA-11340DC85EDC> /usr/lib/libc++.1.dylib
    0x7fff64714000 -     0x7fff64729ffb  libc++abi.dylib (902) <E692F14F-C65E-303B-9921-BB7E97D77855> /usr/lib/libc++abi.dylib
    0x7fff6472a000 -     0x7fff6472afff  libcharset.1.dylib (59) <72447768-9244-39AB-8E79-2FA14EC0AD33> /usr/lib/libcharset.1.dylib
    0x7fff65193000 -     0x7fff65195fff  libfakelink.dylib (149.1) <36146CB2-E6A5-37BB-9EE8-1B4034D8F3AD> /usr/lib/libfakelink.dylib
    0x7fff651b4000 -     0x7fff652a4fff  libiconv.2.dylib (59) <18311A67-E4EF-3CC7-95B3-C0EDEE3A282F> /usr/lib/libiconv.2.dylib
    0x7fff652a5000 -     0x7fff654fcfff  libicucore.A.dylib (64260.0.1) <8AC2CB07-E7E0-340D-A849-186FA1F27251> /usr/lib/libicucore.A.dylib
    0x7fff6623b000 -     0x7fff6626efde  libobjc.A.dylib (787.1) <6DF81160-5E7F-3E31-AA1E-C875E3B98AF6> /usr/lib/libobjc.A.dylib
    0x7fff66917000 -     0x7fff66929ff3  libz.1.dylib (76) <793D9643-CD83-3AAC-8B96-88D548FAB620> /usr/lib/libz.1.dylib
    0x7fff671d8000 -     0x7fff671ddff3  libcache.dylib (83) <AF488D13-9E89-35E0-B078-BE37CC5B8586> /usr/lib/system/libcache.dylib
    0x7fff671de000 -     0x7fff671e9fff  libcommonCrypto.dylib (60165.120.1) <C7912BE5-993E-3581-B2A0-6AABDC8C5562> /usr/lib/system/libcommonCrypto.dylib
    0x7fff671ea000 -     0x7fff671f1fff  libcompiler_rt.dylib (101.2) <49B8F644-5705-3F16-BBE0-6FFF9B17C36E> /usr/lib/system/libcompiler_rt.dylib
    0x7fff671f2000 -     0x7fff671fbff7  libcopyfile.dylib (166.40.1) <3C481225-21E7-370A-A30E-0CCFDD64A92C> /usr/lib/system/libcopyfile.dylib
    0x7fff671fc000 -     0x7fff6728efdb  libcorecrypto.dylib (866.140.1) <60567BF8-80FA-359A-B2F3-A3BAEFB288FD> /usr/lib/system/libcorecrypto.dylib
    0x7fff6739b000 -     0x7fff673dbff0  libdispatch.dylib (1173.100.2) <CD9C059C-91D9-30E8-8926-5B9CD0D5D4F5> /usr/lib/system/libdispatch.dylib
    0x7fff673dc000 -     0x7fff67412fff  libdyld.dylib (750.6) <789A18C2-8AC7-3C88-813D-CD674376585D> /usr/lib/system/libdyld.dylib
    0x7fff67413000 -     0x7fff67413ffb  libkeymgr.dylib (30) <DB3337BE-01CA-3425-BD0C-87774FC0CDC0> /usr/lib/system/libkeymgr.dylib
    0x7fff67421000 -     0x7fff67421ff7  liblaunch.dylib (1738.140.1) <AFBCBDD3-0B55-3ECD-8E04-A73A3A57356B> /usr/lib/system/liblaunch.dylib
    0x7fff67422000 -     0x7fff67427ff7  libmacho.dylib (959.0.1) <AA613A9C-961A-3B67-B696-4622FA59FC4E> /usr/lib/system/libmacho.dylib
    0x7fff67428000 -     0x7fff6742aff3  libquarantine.dylib (110.40.3) <F234E51D-FD0B-3EE4-B679-AE3EE9C536C3> /usr/lib/system/libquarantine.dylib
    0x7fff6742b000 -     0x7fff6742cff7  libremovefile.dylib (48) <7C7EFC79-BD24-33EF-B073-06AED234593E> /usr/lib/system/libremovefile.dylib
    0x7fff6742d000 -     0x7fff67444ff3  libsystem_asl.dylib (377.60.2) <1563EE02-0657-3B78-99BE-A947C24122EF> /usr/lib/system/libsystem_asl.dylib
    0x7fff67445000 -     0x7fff67445ff7  libsystem_blocks.dylib (74) <0D53847E-AF5F-3ACF-B51F-A15DEA4DEC58> /usr/lib/system/libsystem_blocks.dylib
    0x7fff67446000 -     0x7fff674cdfff  libsystem_c.dylib (1353.100.2) <BBDED5E6-A646-3EED-B33A-91E4331EA063> /usr/lib/system/libsystem_c.dylib
    0x7fff674ce000 -     0x7fff674d1ffb  libsystem_configuration.dylib (1061.141.1) <0EE84C33-64FD-372B-974A-AF7A136F2068> /usr/lib/system/libsystem_configuration.dylib
    0x7fff674d2000 -     0x7fff674d5fff  libsystem_coreservices.dylib (114) <A199156E-058D-3ABB-BCE9-4B9F20DCED0F> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff674d6000 -     0x7fff674defff  libsystem_darwin.dylib (1353.100.2) <5B12B5DB-3F30-37C1-8ECC-49A66B1F2864> /usr/lib/system/libsystem_darwin.dylib
    0x7fff674df000 -     0x7fff674e6fff  libsystem_dnssd.dylib (1096.100.3) <EBB4C2C2-E031-3094-B40A-E67BF261D295> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff674e7000 -     0x7fff674e8ffb  libsystem_featureflags.dylib (17) <29FD922A-EC2C-3F25-BCCC-B58D716E60EC> /usr/lib/system/libsystem_featureflags.dylib
    0x7fff674e9000 -     0x7fff67536ff7  libsystem_info.dylib (538) <8A321605-5480-330B-AF9E-64E65DE61747> /usr/lib/system/libsystem_info.dylib
    0x7fff67537000 -     0x7fff67563ff7  libsystem_kernel.dylib (6153.141.2.2) <5CDBBC06-6CA6-3432-9FDA-681047866F3E> /usr/lib/system/libsystem_kernel.dylib
    0x7fff67564000 -     0x7fff675abfff  libsystem_m.dylib (3178) <00F331F1-0D09-39B3-8736-1FE90E64E903> /usr/lib/system/libsystem_m.dylib
    0x7fff675ac000 -     0x7fff675d3fff  libsystem_malloc.dylib (283.100.6) <8549294E-4C53-36EB-99F3-584A7393D8D5> /usr/lib/system/libsystem_malloc.dylib
    0x7fff675d4000 -     0x7fff675e1ffb  libsystem_networkextension.dylib (1095.140.2) <F06C65C5-2CBE-313C-96E1-A09240F9FE57> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff675e2000 -     0x7fff675ebff7  libsystem_notify.dylib (241.100.2) <FA22F928-D91B-3AA5-96BB-3186AC0FB264> /usr/lib/system/libsystem_notify.dylib
    0x7fff675ec000 -     0x7fff675f4fef  libsystem_platform.dylib (220.100.1) <009A7C1F-313A-318E-B9F2-30F4C06FEA5C> /usr/lib/system/libsystem_platform.dylib
    0x7fff675f5000 -     0x7fff675fffff  libsystem_pthread.dylib (416.100.3) <62CB1A98-0B8F-31E7-A02B-A1139927F61D> /usr/lib/system/libsystem_pthread.dylib
    0x7fff67600000 -     0x7fff67604ff3  libsystem_sandbox.dylib (1217.141.2) <051C4018-4345-3034-AC98-6DE42FB8273B> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff67605000 -     0x7fff67607fff  libsystem_secinit.dylib (62.100.2) <F80872AA-E1FD-3D7E-8729-467656EC6561> /usr/lib/system/libsystem_secinit.dylib
    0x7fff67608000 -     0x7fff6760fffb  libsystem_symptoms.dylib (1238.120.1) <5820A2AF-CE72-3AB3-ABCC-273A3419FB55> /usr/lib/system/libsystem_symptoms.dylib
    0x7fff67610000 -     0x7fff67626ff2  libsystem_trace.dylib (1147.120) <04B47629-847B-3D74-8ABE-C05EF9DEEFE4> /usr/lib/system/libsystem_trace.dylib
    0x7fff67628000 -     0x7fff6762dff7  libunwind.dylib (35.4) <42B7B509-BAFE-365B-893A-72414C92F5BF> /usr/lib/system/libunwind.dylib
    0x7fff6762e000 -     0x7fff67663ffe  libxpc.dylib (1738.140.1) <3E243A41-030F-38E3-9FD2-7B38C66C35B1> /usr/lib/system/libxpc.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 10778898
    thread_create: 0
    thread_set_state: 36

VM Region Summary:
ReadOnly portion of Libraries: Total=408.0M resident=0K(0%) swapped_out_or_unallocated=408.0M(100%)
Writable regions: Total=441.1M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=441.1M(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Activity Tracing                   256K        1 
Kernel Alloc Once                    8K        1 
MALLOC                            62.1M       19 
MALLOC guard page                   24K        4 
MALLOC_MEDIUM (reserved)         360.0M        3         reserved VM address space (unallocated)
STACK GUARD                          4K        1 
Stack                             16.0M        1 
VM_ALLOCATE                       2304K        9 
__DATA                            2807K       55 
__DATA_CONST                       120K        6 
__LINKEDIT                       390.7M       10 
__OBJC_RO                         32.3M        1 
__OBJC_RW                         1908K        2 
__TEXT                            17.3M       51 
__UNICODE                          564K        1 
shared memory                       12K        3 
===========                     =======  ======= 
TOTAL                            886.2M      168 
TOTAL, minus reserved VM space   526.2M      168