Application crash due to dereference garbage pointer

2

I am seeing few random crashes in my iPod application with following message common in all the crash reports (though they have different thread traces). The crash is not reproducible - it occurs pretty randomly.

Attempted to dereference garbage pointer

I am also attaching a sample crash report. Please suggest as how to debug such an issue.

Crash Report:

CrashReporter Key: 6e6f41fdb678cf746d1c4561b2d7bc2b3f6772ad Hardware Model: iPod4,1 Process: TestApplication [3154] Path: /var/mobile/Applications/E5ED253B-A27A-4014-885A-030D19C7CB2C/TestApplication.app/TestApplication Identifier: com.domain.retail.TestApplication Version: 1.0.0 Code Type: ARM Parent Process: launchd [1]

Date/Time:       2013-04-02 10:37:29.000 +0530
OS Version:      iPhone OS 6.1.3 (10B329)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000cc
Crashed Thread:  10

Thread 0 name:  Dispatch queue: com.domain.main-thread
Thread 0:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   CoreFoundation                  0x32626040 0x3258f000 + 618560
2   CoreFoundation                  0x32624d58 0x3258f000 + 613720
3   CoreFoundation                  0x32597eb8 CFRunLoopRunSpecific + 352
4   CoreFoundation                  0x32597d48 CFRunLoopRunInMode + 104
5   GraphicsServices                0x3614a2e8 GSEventRunModal + 72
6   UIKit                           0x344ad300 UIApplicationMain + 1120
7   TestApplication                          0x000a54d0 main + 44

Thread 1 name:  Dispatch queue: com.domain.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x3a7bd648 kevent64 + 24
1   libdispatch.dylib               0x3a6e8df8 0x3a6e5000 + 15864

Thread 2 name:  WebThread
Thread 2:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   CoreFoundation                  0x32626040 0x3258f000 + 618560
2   CoreFoundation                  0x32624da0 0x3258f000 + 613792
3   CoreFoundation                  0x32597eb8 CFRunLoopRunSpecific + 352
4   CoreFoundation                  0x32597d48 CFRunLoopRunInMode + 104
5   WebCore                         0x38585500 0x3857b000 + 42240
6   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 3:
0   libsystem_kernel.dylib          0x3a7cd6a4 __semwait_signal + 24
1   Foundation                      0x32f0ac60 0x32eb7000 + 343136
2   TestApplication                          0x0031c9c0 -[KSCrashDeadlockMonitor runMonitor] + 244
3   Foundation                      0x32f67e80 0x32eb7000 + 724608
4   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 4 name:  KSCrash Exception Handler (Secondary)
Thread 4:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   TestApplication                          0x00318b50 ksmachexc_i_handleExceptions + 124
2   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 5 name:  KSCrash Exception Handler (Primary)
Thread 5:

Thread 6 name:  com.domain.NSURLConnectionLoader
Thread 6:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   CoreFoundation                  0x32626040 0x3258f000 + 618560
2   CoreFoundation                  0x32624da0 0x3258f000 + 613792
3   CoreFoundation                  0x32597eb8 CFRunLoopRunSpecific + 352
4   CoreFoundation                  0x32597d48 CFRunLoopRunInMode + 104
5   Foundation                      0x32ee43d0 0x32eb7000 + 185296
6   Foundation                      0x32f67e80 0x32eb7000 + 724608
7   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 7 name:  com.domain.CFSocket.private
Thread 7:
0   libsystem_kernel.dylib          0x3a7cd594 select$DARWIN_EXTSN + 20
1   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 8 name:  JavaScriptCore::BlockFree
Thread 8:
0   libsystem_kernel.dylib          0x3a7cd08c __psynch_cvwait + 24
1   libsystem_c.dylib               0x3a71eaa0 pthread_cond_timedwait + 40
2   JavaScriptCore                  0x36540c70 _ZN3WTF15ThreadCondition9timedWaitERNS_5MutexEd + 104
3   JavaScriptCore                  0x36652550 0x364e5000 + 1496400
4   JavaScriptCore                  0x36664fa8 0x364e5000 + 1572776
5   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 9:
0   libsystem_kernel.dylib          0x3a7cdd98 __workq_kernreturn + 8
1   libsystem_c.dylib               0x3a71ba10 0x3a715000 + 27152

Thread 10 name:  Dispatch queue: com.domain.root.high-priority
Thread 10 Crashed:
0   libicucore.A.dylib              0x39e5e570 ucol_getVersion + 0
1   TextInput                       0x37d741b0 _ZN2KB8WordTrie4loadERKNS_6StringE + 280
2   TextInput                       0x37d6d698 0x37d35000 + 231064
3   TextInput                       0x380de2f8 0x37d35000 + 3838712
4   TextInput                       0x380de298 0x37d35000 + 3838616
5   TextInput                       0x37d65170 _ZN14TIInputManager17load_dictionariesERKN2KB6StringES3_b + 20
6   TextInput                       0x37d761c8 0x37d35000 + 266696
7   TextInput                       0x37d75e08 0x37d35000 + 265736
8   UIKit                           0x3454ffd0 0x34456000 + 1023952
9   UIKit                           0x3454f018 0x34456000 + 1019928
10  UIKit                           0x3454ec28 0x34456000 + 1018920
11  UIKit                           0x3454d500 0x34456000 + 1012992
12  UIKit                           0x3454d1f0 0x34456000 + 1012208
13  UIKit                           0x345afa48 0x34456000 + 1415752
14  UIKit                           0x345ac918 0x34456000 + 1403160
15  UIKit                           0x345ac618 0x34456000 + 1402392
16  UIKit                           0x345ab018 0x34456000 + 1396760
17  UIKit                           0x345aae40 0x34456000 + 1396288
18  UIKit                           0x345aa780 0x34456000 + 1394560
19  TestApplication                          0x00155e90 -[TestApplicationRequestInfoController showScanAlertForErrorType:Barcode:] + 2380
20  TestApplication                          0x00151c48 -[TestApplicationRequestInfoController showAlertForErrorType:Barcode:] + 72
21  TestApplication                          0x001fe090 -[TestApplicationBOPISOrdersScanningController processFirstNonSerialNumberScan:] + 3788
22  TestApplication                          0x0020dd38 -[TestApplicationScanController processScanInfo] + 3512
23  TestApplication                          0x0020cf38 __39-[TestApplicationScanController startScanThread]_block_invoke + 44
24  libdispatch.dylib               0x3a6e7118 0x3a6e5000 + 8472
25  libdispatch.dylib               0x3a6f5258 0x3a6e5000 + 66136
26  libdispatch.dylib               0x3a6f53b8 0x3a6e5000 + 66488
27  libsystem_c.dylib               0x3a71ba10 0x3a715000 + 27152

Thread 11:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   CoreFoundation                  0x32626040 0x3258f000 + 618560
2   CoreFoundation                  0x32624da0 0x3258f000 + 613792
3   CoreFoundation                  0x32597eb8 CFRunLoopRunSpecific + 352
4   CoreFoundation                  0x32597d48 CFRunLoopRunInMode + 104
5   Foundation                      0x32ebaf90 0x32eb7000 + 16272
6   Foundation                      0x32ec3d50 0x32eb7000 + 52560
7   TestApplication                          0x002cc288 -[CommStream runLoopThread:] + 704
8   Foundation                      0x32f67e80 0x32eb7000 + 724608
9   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 12:
0   libsystem_kernel.dylib          0x3a7cd594 select$DARWIN_EXTSN + 20
1   Foundation                      0x32f67e80 0x32eb7000 + 724608
2   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 13:
0   libsystem_kernel.dylib          0x3a7bceb4 mach_msg_trap + 20
1   CoreFoundation                  0x32626040 0x3258f000 + 618560
2   CoreFoundation                  0x32624da0 0x3258f000 + 613792
3   CoreFoundation                  0x32597eb8 CFRunLoopRunSpecific + 352
4   CoreFoundation                  0x32597d48 CFRunLoopRunInMode + 104
5   Foundation                      0x32ebaf90 0x32eb7000 + 16272
6   Foundation                      0x32ec3d50 0x32eb7000 + 52560
7   TestApplication                          0x002cc288 -[CommStream runLoopThread:] + 704
8   Foundation                      0x32f67e80 0x32eb7000 + 724608
9   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 14:
0   libsystem_kernel.dylib          0x3a7cd594 select$DARWIN_EXTSN + 20
1   Foundation                      0x32f67e80 0x32eb7000 + 724608
2   libsystem_c.dylib               0x3a726310 0x3a715000 + 70416

Thread 15:
0   libsystem_kernel.dylib          0x3a7cdd98 __workq_kernreturn + 8
1   libsystem_c.dylib               0x3a71ba10 0x3a715000 + 27152

Thread 10 crashed with ARM Thread State:
    r0: 0x00000000     r1: 0x05fe1320     r2: 0x00000001     r3: 0x00000001 
    r4: 0x03000000     r5: 0x07000000     r6: 0x05a1c000     r7: 0x05fe1394 
    r8: 0x05fe14d8     r9: 0x00000000    r10: 0x37d5f865    r11: 0x05fe14c8 
    ip: 0x3be8e2bc     sp: 0x05fe1300     lr: 0x37d74427     pc: 0x39e5e570 
  cpsr: 0x20000030 

CrashDoctor Diagnosis: Attempted to dereference garbage pointer 0xcc.
Originated at or in a subcall of -[TestApplicationRequestInfoController showScanAlertForErrorType:Barcode:]
ios
debugging
crash
exc-bad-access
asked on Stack Overflow Apr 4, 2013 by Abhinav • edited Apr 4, 2013 by jscs

1 Answer

1

Have a look at thread 10:

one of these functions might some issue:

19  TestApplication                          0x00155e90 -[TestApplicationRequestInfoController showScanAlertForErrorType:Barcode:] + 2380
20  TestApplication                          0x00151c48 -[TestApplicationRequestInfoController showAlertForErrorType:Barcode:] + 72
21  TestApplication                          0x001fe090 -[TestApplicationBOPISOrdersScanningController processFirstNonSerialNumberScan:] + 3788
22  TestApplication                          0x0020dd38 -[TestApplicationScanController processScanInfo] + 3512
23  TestApplication                          0x0020cf38 __39-[TestApplicationScanController startScanThread]_block_invoke + 44

Double check them. Or put breakpoints at them and rerun the program to see what happens when the program goes through these functions..

Hope this helps... Just a starter..

Remember there is no random crashing.. These crashes are due to mistakes in the code.

answered on Stack Overflow Apr 4, 2013 by lakesh

User contributions licensed under CC BY-SA 3.0