NSObjectSafe icon indicating copy to clipboard operation
NSObjectSafe copied to clipboard

I've had a crash in this line by using RNCryptor library

Open decim92 opened this issue 7 years ago • 4 comments

https://github.com/jasenhuang/NSObjectSafe/blob/703982ea9f0797b0cbfd168c24d4d077fdacb2cc/NSObjectSafe/NSObjectSafe.m#L868

Setting <= self.length fixed the crash but I don't know whether something else will be broken or not

decim92 avatar Sep 10 '18 02:09 decim92

@kiritoxcii would you show the demo code or paste crash stack?

jasenhuang avatar Oct 15 '18 13:10 jasenhuang

I have the same problem,the crash stack:2019-03-01 17:11:51.292927+0800 AndClient Chinamobile[8572:2364047] /Users/ningliu/AndClient-iOS/AndClient/Extensions/Safe/NSObjectSafe.m|-[NSMutableData(Safe) hookReplaceBytesInRange:withBytes:]|1005|hookReplaceBytesInRange:withBytes: range.location error 2019-03-01 17:11:51.292992+0800 AndClient Chinamobile[8572:2364047] *** Assertion failure in -[NSConcreteMutableData replaceBytesInRange:withBytes:], /Users/ningliu/AndClient-iOS/AndClient/Extensions/Safe/NSObjectSafe.m:1005 2019-03-01 17:11:51.294340+0800 AndClient Chinamobile[8572:2364047] dynamic_cast error 2: One or more of the following type_info's has hidden visibility. They should all have public visibility. N10__cxxabiv116__shim_type_infoE, id, N10__cxxabiv117__pbase_type_infoE. 2019-03-01 17:11:51.294367+0800 AndClient Chinamobile[8572:2364047] dynamic_cast error 2: One or more of the following type_info's has hidden visibility. They should all have public visibility. N10__cxxabiv116__shim_type_infoE, id, N10__cxxabiv117__pbase_type_infoE. 2019-03-01 17:11:51.333728+0800 AndClient Chinamobile[8572:2364047] [Bugly] Trapped uncaught exception 'NSInternalInconsistencyException', reason: 'hookReplaceBytesInRange:withBytes: range.location error' [ "0 CoreFoundation 0x000000021b1a0edc + 252", "1 libobjc.A.dylib 0x000000021a371a40 objc_exception_throw + 56", "2 CoreFoundation 0x000000021b0b6b3c + 0", "3 Foundation 0x000000021bba51d0 + 112", "4 AndClient Chinamobile 0x0000000100a45ea4 -[NSMutableData(Safe) hookReplaceBytesInRange:withBytes:] + 448", "5 Foundation 0x000000021bbc1ccc + 88", "6 AndClient Chinamobile 0x0000000100adeaf4 __23-[RNEncryptor addData:]_block_invoke + 160", "7 libdispatch.dylib 0x0000000103683824 _dispatch_call_block_and_release + 24", "8 libdispatch.dylib 0x0000000103684dc8 _dispatch_client_callout + 16", "9 libdispatch.dylib 0x000000010368ce6c _dispatch_lane_serial_drain + 720", "10 libdispatch.dylib 0x000000010368db60 _dispatch_lane_invoke + 460", "11 libdispatch.dylib 0x0000000103697bfc _dispatch_workloop_worker_thread + 1220", "12 libsystem_pthread.dylib 0x000000021adbd0dc _pthread_wqthread + 312", "13 libsystem_pthread.dylib 0x000000021adbfcec start_wqthread + 4" ]

leo4developer avatar Mar 01 '19 09:03 leo4developer

@leo4developer @kiritoxcii actually, it's Assertion failure inside NSObjectSafe because of replaceBytesInRange with range.location == data.length,the default behavior of system api will append bytes to target.change to <= self.length is right.

jasenhuang avatar Mar 01 '19 10:03 jasenhuang

@leo4developer @kiritoxcii actually, it's Assertion failure inside NSObjectSafe because of replaceBytesInRange with range.location == data.length,the default behavior of system api will append bytes to target.change to <= self.length is right.

谢谢!

leo4developer avatar Mar 04 '19 05:03 leo4developer