Archived Forum Post

Index of archived forum posts

Question:

EXC_BAD_ACCESS in LogContextExitor destructor

Aug 20 '14 at 05:26

Update: See my answer below, it was my bug.

This is with the latest production (not pre-release) 9.5.0 version, on iOS 7.1.2. I've confirmed the from-path exists and is valid.

I'm assuming an EXC_BAD_ACCESS in a destructor is a bug rather than user error…

alt text

LogContextExitor::~LogContextExitor():
0x426ca4:  push   {r4, r7, lr}
0x426ca6:  mov    r4, r0
0x426ca8:  movw   r0, #0x9fe6
0x426cac:  movt   r0, #0x7b
0x426cb0:  add    r7, sp, #0x4
0x426cb2:  add    r0, pc
0x426cb4:  adds   r0, #0x8
0x426cb6:  str    r0, [r4]
0x426cb8:  ldr    r0, [r4, #0x4]
0x426cba:  cbz    r0, 0x426cc2              ; LogContextExitor::~LogContextExitor() + 30
0x426cbc:  ldr    r1, [r0]
0x426cbe:  ldr    r1, [r1, #0x2c]
0x426cc0:  blx    r1
0x426cc2:  movs   r0, #0x0
0x426cc4:  str    r0, [r4, #0x4]
0x426cc6:  mov    r0, r4
0x426cc8:  pop    {r4, r7, pc}
0x426cca:  mov    r8, r8

-[CkoCrypt2 CkDecryptFile:destFile:]:
0xcc33c:  push   {r4, r5, r6, r7, lr}
0xcc33e:  add    r7, sp, #0xc
0xcc340:  str    r8, [sp, #-4]!
0xcc344:  mov    r8, r0
0xcc346:  movw   r0, #0xabc8
0xcc34a:  movt   r0, #0xba
0xcc34e:  mov    r4, r3
0xcc350:  add    r0, pc
0xcc352:  ldr    r6, [r0]
0xcc354:  mov    r0, r2
0xcc356:  mov    r1, r6
0xcc358:  blx    0xa1ba94                  ; symbol stub for: objc_msgSend
0xcc35c:  mov    r5, r0
0xcc35e:  mov    r0, r4
0xcc360:  mov    r1, r6
0xcc362:  blx    0xa1ba94                  ; symbol stub for: objc_msgSend
0xcc366:  mov    r2, r0
0xcc368:  movw   r0, #0x9c9a
0xcc36c:  movt   r0, #0xbb
0xcc370:  mov    r1, r5
0xcc372:  add    r0, pc
0xcc374:  ldr    r0, [r0]
0xcc376:  ldr.w  r0, [r8, r0]
0xcc37a:  bl     0x15ff24                  ; CkCrypt2::CkDecryptFile(char const*, char const*)
0xcc37e:  ldr    r8, [sp], #4
0xcc382:  pop    {r4, r5, r6, r7, pc}

Answer

Never mind, my bug. I was releasing the CkoCrypt2 object on a different thread to the serial queue where I was using it…