[GH-ISSUE #1097] [BUG] Crash app when parsing Protobuf data with NaN value #1092

Open
opened 2026-03-03 19:48:18 +03:00 by kerem · 3 comments
Owner

Originally created by @NghiaTranUIT on GitHub (Dec 21, 2021).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1097

Originally assigned to: @NghiaTranUIT on GitHub.

Description

If the Protobuf content has a NaN (Not a Number) value, Proxyman will get crashed because JSONSerialization doesn't accept NaN Value. As a result, it throws the exception: NSInvalidArgumentException', reason: 'NaN number in JSON write

Acceptance Criteria

  • Fix it
Originally created by @NghiaTranUIT on GitHub (Dec 21, 2021). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1097 Originally assigned to: @NghiaTranUIT on GitHub. ### Description If the Protobuf content has a NaN (Not a Number) value, Proxyman will get crashed because JSONSerialization doesn't accept NaN Value. As a result, it throws the exception: `NSInvalidArgumentException', reason: 'NaN number in JSON write ` ### Acceptance Criteria - Fix it
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 21, 2021):

Done with https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_2.35.3_Crash_protobuf.dmg

<!-- gh-comment-id:998517115 --> @NghiaTranUIT commented on GitHub (Dec 21, 2021): Done with https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_2.35.3_Crash_protobuf.dmg
Author
Owner

@biu7 commented on GitHub (Oct 11, 2022):

@NghiaTranUIT This problem is still present in version 3.11.0

2022-10-11 18:35:46.550 Proxyman[65507:1580053] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NaN number in JSON write'
*** First throw call stack:
(
0 CoreFoundation 0x00000001af7e9148 __exceptionPreprocess + 240
1 libobjc.A.dylib 0x00000001af533e04 objc_exception_throw + 60
2 Foundation 0x00000001b06a0a9c _writeJSONValue + 836
3 Foundation 0x00000001b06a1420 ___writeJSONObject_block_invoke + 388
4 Foundation 0x00000001b06a0e7c _writeJSONObject + 912
5 Foundation 0x00000001b06a1420 ___writeJSONObject_block_invoke + 388
6 Foundation 0x00000001b06a0e7c _writeJSONObject + 912
7 Foundation 0x00000001b06c5bb8 ___writeJSONArray_block_invoke + 260
8 CoreFoundation 0x00000001af75be14 NSARRAY_IS_CALLING_OUT_TO_A_BLOCK + 24
9 CoreFoundation 0x00000001af760460 __NSArrayEnumerate + 452
10 Foundation 0x00000001b06c59e8 _writeJSONArray + 356
11 Foundation 0x00000001b06a1420 ___writeJSONObject_block_invoke + 388
12 Foundation 0x00000001b06a0e7c _writeJSONObject + 912
13 Foundation 0x00000001b087cba0 -[_NSJSONWriter dataWithRootObject:options:] + 88
14 Foundation 0x00000001b06a0620 +[NSJSONSerialization dataWithJSONObject:options:error:] + 120
15 ProxymanCore 0x0000000106a8e858 __swift_memcpy105_8 + 39788
16 ProxymanCore 0x0000000106a5fbec __swift_memcpy192_8 + 41996
17 ProxymanCore 0x0000000106a5e9ec __swift_memcpy192_8 + 37388
18 ProxymanCore 0x0000000106a5ef4c __swift_memcpy192_8 + 38764
19 ProxymanCore 0x0000000106a607a0 block_destroy_helper + 80
20 ProxymanCore 0x0000000106b2b148 __swift_memcpy160_8 + 16696
21 libdispatch.dylib 0x00000001af4d65f0 _dispatch_call_block_and_release + 32
22 libdispatch.dylib 0x00000001af4d81b4 _dispatch_client_callout + 20
23 libdispatch.dylib 0x00000001af4df8a8 _dispatch_lane_serial_drain + 668
24 libdispatch.dylib 0x00000001af4e0404 _dispatch_lane_invoke + 392
25 libdispatch.dylib 0x00000001af4eac98 _dispatch_workloop_worker_thread + 648
26 libsystem_pthread.dylib 0x00000001af698360 _pthread_wqthread + 288
27 libsystem_pthread.dylib 0x00000001af697080 start_wqthread + 8
)
[1] 65507 abort /Applications/Proxyman.app/Contents/MacOS/Proxyman

<!-- gh-comment-id:1274486445 --> @biu7 commented on GitHub (Oct 11, 2022): @NghiaTranUIT This problem is still present in version 3.11.0 2022-10-11 18:35:46.550 Proxyman[65507:1580053] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NaN number in JSON write' *** First throw call stack: ( 0 CoreFoundation 0x00000001af7e9148 __exceptionPreprocess + 240 1 libobjc.A.dylib 0x00000001af533e04 objc_exception_throw + 60 2 Foundation 0x00000001b06a0a9c _writeJSONValue + 836 3 Foundation 0x00000001b06a1420 ___writeJSONObject_block_invoke + 388 4 Foundation 0x00000001b06a0e7c _writeJSONObject + 912 5 Foundation 0x00000001b06a1420 ___writeJSONObject_block_invoke + 388 6 Foundation 0x00000001b06a0e7c _writeJSONObject + 912 7 Foundation 0x00000001b06c5bb8 ___writeJSONArray_block_invoke + 260 8 CoreFoundation 0x00000001af75be14 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 24 9 CoreFoundation 0x00000001af760460 __NSArrayEnumerate + 452 10 Foundation 0x00000001b06c59e8 _writeJSONArray + 356 11 Foundation 0x00000001b06a1420 ___writeJSONObject_block_invoke + 388 12 Foundation 0x00000001b06a0e7c _writeJSONObject + 912 13 Foundation 0x00000001b087cba0 -[_NSJSONWriter dataWithRootObject:options:] + 88 14 Foundation 0x00000001b06a0620 +[NSJSONSerialization dataWithJSONObject:options:error:] + 120 15 ProxymanCore 0x0000000106a8e858 __swift_memcpy105_8 + 39788 16 ProxymanCore 0x0000000106a5fbec __swift_memcpy192_8 + 41996 17 ProxymanCore 0x0000000106a5e9ec __swift_memcpy192_8 + 37388 18 ProxymanCore 0x0000000106a5ef4c __swift_memcpy192_8 + 38764 19 ProxymanCore 0x0000000106a607a0 block_destroy_helper + 80 20 ProxymanCore 0x0000000106b2b148 __swift_memcpy160_8 + 16696 21 libdispatch.dylib 0x00000001af4d65f0 _dispatch_call_block_and_release + 32 22 libdispatch.dylib 0x00000001af4d81b4 _dispatch_client_callout + 20 23 libdispatch.dylib 0x00000001af4df8a8 _dispatch_lane_serial_drain + 668 24 libdispatch.dylib 0x00000001af4e0404 _dispatch_lane_invoke + 392 25 libdispatch.dylib 0x00000001af4eac98 _dispatch_workloop_worker_thread + 648 26 libsystem_pthread.dylib 0x00000001af698360 _pthread_wqthread + 288 27 libsystem_pthread.dylib 0x00000001af697080 start_wqthread + 8 ) [1] 65507 abort /Applications/Proxyman.app/Contents/MacOS/Proxyman
Author
Owner

@jjmean2 commented on GitHub (Mar 7, 2023):

I experienced this exactly same issue in latest Proxyman v4.3.1

09:09:20.854036+0900	Proxyman	*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NaN number in JSON write'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000019744c3e8 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x0000000196f96ea8 objc_exception_throw + 60
	2   Foundation                          0x000000019831e6d0 _writeJSONValue + 788
	3   Foundation                          0x000000019831efdc ___writeJSONObject_block_invoke + 388
	4   Foundation                          0x000000019831ea74 _writeJSONObject + 868
	5   Foundation                          0x000000019833fef8 ___writeJSONArray_block_invoke + 260
	6   CoreFoundation                      0x00000001973c5070 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 24
	7   CoreFoundation                      0x00000001973c9578 __NSArrayEnumerate + 404
	8   Foundation                          0x000000019833fd28 _writeJSONArray + 348
	9   Foundation                          0x000000019831efdc ___writeJS<…>
<!-- gh-comment-id:1457260600 --> @jjmean2 commented on GitHub (Mar 7, 2023): I experienced this exactly same issue in latest Proxyman v4.3.1 ``` 09:09:20.854036+0900 Proxyman *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NaN number in JSON write' *** First throw call stack: ( 0 CoreFoundation 0x000000019744c3e8 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x0000000196f96ea8 objc_exception_throw + 60 2 Foundation 0x000000019831e6d0 _writeJSONValue + 788 3 Foundation 0x000000019831efdc ___writeJSONObject_block_invoke + 388 4 Foundation 0x000000019831ea74 _writeJSONObject + 868 5 Foundation 0x000000019833fef8 ___writeJSONArray_block_invoke + 260 6 CoreFoundation 0x00000001973c5070 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 24 7 CoreFoundation 0x00000001973c9578 __NSArrayEnumerate + 404 8 Foundation 0x000000019833fd28 _writeJSONArray + 348 9 Foundation 0x000000019831efdc ___writeJS<…> ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1092
No description provided.