rist_peer_create crashes on macOS, iOS, Android when URL with non-existing host passed
Our application using librist crashes when URL with non-existing host (e.g. rist://asdzxc.info:5555 ) provided with crash dump like this:
Crashed: SRT_frame_sender0
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000004
udpsocket_resolve_host
0 udpsocket.c - Line 41 udpsocket_resolve_host + 41
1 udp.c - Line 375 rist_set_url + 375
2 udp.c - Line 458 rist_create_socket + 458
3 rist-common.c - Line 3219 rist_sender_peer_insert_local + 3219
4 rist.c - Line 726 rist_sender_peer_create + 726
5 rist.c - Line 793 rist_peer_create + 793
6 RistEngine.m - Line 95 -[RistEngine open:] + 95
We found that in this case getaddrinfo function returns EAI_NONAME, which is defined as 8 on that platforms, and condition if (gai_ret < 0)
in udpsocket.c:37 did not executed. As we can see from manpages , getaddrinfo returns non-zero in a case of failure, thus condition should be changed to if (gai_ret == 0)
to make it work properly on all platforms.
This issue also can be reproduced on macOS with command like this (causes segmentation fault):
ristreceiver -i rist://zxcvsdfg.info:8888 -o udp://224.1.2.3:6666
I've created pull request with one-line fix, please help to propagate it.