Coderlab / apportable

Automatically exported from code.google.com/p/apportable
0 stars 0 forks source link

NSData's increaseLengthBy: is crashing #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am using GCDAsyncSocket in my app. When tested in my project, the app is 
crashing in place, where:

[buffer increaseLengthBy:buffInc];

is called. Buffer variable is NSData's instance.

The call stacktrace is:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 23809]
0x400859c0 in memset () from 
/Users/sarsonj/.apportable/cache/devices/015d2109a75c001b/libs/libc.so
(gdb) bt
#0  0x400859c0 in memset () from 
/Users/sarsonj/.apportable/cache/devices/015d2109a75c001b/libs/libc.so
#1  0x6a405638 in _2D__5B_NSMutableDataMalloc_20_setLength_3A__5D_ () from 
/Users/sarsonj/.apportable/SDK/sysroot/android/armeabi/usr/lib/libFoundation.so
#2  0x6a400e98 in _2D__5B_NSMutableData_20_increaseLengthBy_3A__5D_ () from 
/Users/sarsonj/.apportable/SDK/sysroot/android/armeabi/usr/lib/libFoundation.so
#3  0x6ac8f1d4 in -[GCDAsyncReadPacket 
ensureCapacityForAdditionalDataOfLength:] (self=0x6b2500c0, _cmd=0x6adf3910 
<L_OBJC_METH_VAR_NAME_52>, bytesToRead=1807744368) at 
/Users/sarsonj/Documents/work/git/xmpp-android/Vendor/CocoaAsyncSocket/GCDAsyncS
ocket.m:564
#4  0x6aca43c4 in -[GCDAsyncSocket doReadData] (self=0x6b201350, 
_cmd=0x6adf41e0 <L_OBJC_METH_VAR_NAME_560>) at 
/Users/sarsonj/Documents/work/git/xmpp-android/Vendor/CocoaAsyncSocket/GCDAsyncS
ocket.m:4500
#5  0x6aca1510 in __66-[GCDAsyncSocket 
setupReadAndWriteSourcesForNewlyConnectedSocket:]_block_invoke 
(.block_descriptor=0x6b213720) at 
/Users/sarsonj/Documents/work/git/xmpp-android/Vendor/CocoaAsyncSocket/GCDAsyncS
ocket.m:3627
#6  0x67070a28 in _dispatch_source_invoke () from 
/Users/sarsonj/.apportable/SDK/sysroot/android/armeabi/usr/lib/libdispatch.so
#7  0x6706db78 in _dispatch_queue_invoke () from 
/Users/sarsonj/.apportable/SDK/sysroot/android/armeabi/usr/lib/libdispatch.so
#8  0x6706de7c in _dispatch_queue_drain () from 
/Users/sarsonj/.apportable/SDK/sysroot/android/armeabi/usr/lib/libdispatch.so
#9  0x6706db60 in _dispatch_queue_invoke () from 
/Users/sarsonj/.apportable/SDK/sysroot/android/armeabi/usr/lib/libdispatch.so
#10 0x6706fa54 in _dispatch_worker_thread2 () from 
/Users/sarsonj/.apportable/SDK/sysroot/android/armeabi/usr/lib/libdispatch.so
#11 0x67052a30 in overcommit_worker_main () from 
/Users/sarsonj/.apportable/SDK/sysroot/android/armeabi/usr/lib/libpthread_workqu
eue.so
#12 0x66fe4740 in thread_start () from 
/Users/sarsonj/.apportable/SDK/sysroot/android/armeabi/usr/lib/libv.so
#13 0x4007b3dc in __thread_entry () from 
/Users/sarsonj/.apportable/cache/devices/015d2109a75c001b/libs/libc.so
#14 0x4007aac8 in pthread_create () from 
/Users/sarsonj/.apportable/cache/devices/015d2109a75c001b/libs/libc.so
#15 0x00000000 in ?? ()

Original issue reported on code.google.com by sars...@gmail.com on 29 Jul 2013 at 1:28

GoogleCodeExporter commented 9 years ago

Original comment by jack...@apportable.com on 1 Aug 2013 at 7:53

GoogleCodeExporter commented 9 years ago

Original comment by jack...@apportable.com on 1 Aug 2013 at 7:54

GoogleCodeExporter commented 9 years ago

Original comment by jack...@apportable.com on 1 Aug 2013 at 7:54

GoogleCodeExporter commented 9 years ago

Original comment by jack...@apportable.com on 1 Aug 2013 at 8:14

GoogleCodeExporter commented 9 years ago
I face the same problem, my android version is crashing with segmentation fault 
when do something with the arrays

Original comment by tir...@gmail.com on 22 Oct 2013 at 2:27

GoogleCodeExporter commented 9 years ago

Original comment by dsk...@apportable.com on 1 Nov 2013 at 8:46

GoogleCodeExporter commented 9 years ago

Original comment by i...@apportable.com on 6 Nov 2013 at 12:21

GoogleCodeExporter commented 9 years ago

Original comment by phili...@apportable.com on 6 Nov 2013 at 12:23

GoogleCodeExporter commented 9 years ago

Original comment by dsk...@apportable.com on 7 Nov 2013 at 2:23

GoogleCodeExporter commented 9 years ago

Original comment by dsk...@apportable.com on 7 Nov 2013 at 2:30

GoogleCodeExporter commented 9 years ago
Sorry for the late reply.

I think the cause for this error is incorrect bytesToRead (1807744368) passed 
to [GCDAsyncReadPacket ensureCapacityForAdditionalDataOfLength:]. [NSData 
setLength:] fails to set such a length, but doesn't handle failure correctly. 
Still, we need to understand why [ensureCapacityForAdditionalDataOfLength:] was 
called with 1807744368. Can you submit a test project showing this problem?

Original comment by dsk...@apportable.com on 7 Nov 2013 at 10:05

GoogleCodeExporter commented 9 years ago

Original comment by dsk...@apportable.com on 11 Nov 2013 at 9:35

GoogleCodeExporter commented 9 years ago
Fixed in master after CF merge and 1.1 SDK release

Original comment by pa...@apportable.com on 5 Jan 2014 at 7:30