meetecho / janus-gateway

Janus WebRTC Server
https://janus.conf.meetecho.com
GNU General Public License v3.0
8.23k stars 2.48k forks source link

Segmentation fault if http transport is bound to localhost #945

Closed josch closed 7 years ago

josch commented 7 years ago

When setting ip = 127.0.0.1 in the [general] section of janus.transport.http.cfg I get a segmentation fault. Here is the backtrace:

#0  0x00007fffc1570436 in janus_http_create_daemon (admin=admin@entry=0, 
    path=0x7ffff82c2bb0 "/janus", interface=interface@entry=0x0, 
    ip=0x7ffff82c3f10 "127.0.0.1", port=port@entry=8088, threads=threads@entry=0, 
    server_pem=0x0, server_key=0x0) at transports/janus_http.c:270
#1  0x00007fffc15736e6 in janus_http_init (callback=<optimized out>, 
    config_path=<optimized out>) at transports/janus_http.c:704
#2  0x00007ffff7fa215c in main (argc=<optimized out>, argv=<optimized out>) at janus.c:4150
lminiero commented 7 years ago

Works just fine here, so it's probably an issue with your libmicrohttpd installation. Closing as not a Janus issue.

lminiero commented 7 years ago

PS: line 270 points to a comment in master, which revision is this happening on?

josch commented 7 years ago

The latest release: 0.2.3

So transports/janus_http.c:270 is this:

http://sources.debian.net/src/janus/0.2.3-1/transports/janus_http.c/#L270

Where janus is doing this:

family = ifa->ifa_addr->sa_family;
lminiero commented 7 years ago

Have you tried master instead? If it still happens there, I'll reopen.

josch commented 7 years ago

I checked gdb again and it seems that ifa->ifa_addr is NULL which explains the segfault:

(gdb) print ifa->ifa_addr
$1 = (struct sockaddr *) 0x0
lminiero commented 7 years ago

Just checked that we don't have that check in master either, so it's a good idea to add it. No interface gives me a NULL ifa->ifa_addr (I don't even know if that makes sense, maybe some special interface of some sort) which explains why I never get this. I'll update the module, and other parts of the code where we do the same thing.

lminiero commented 7 years ago

The check was already there for the same code we have in ice.c, which means it was missing only there. Just fixed it, so if you try with master it should work. Not sure how this fix can be incorporated in the repo version of Debian.

lminiero commented 7 years ago

Pinging @jonassmedegaard as he was taking care of that up to some time ago.

jonassmedegaard commented 7 years ago

Quoting Lorenzo Miniero (2017-07-06 11:11:28)

Pinging @jonassmedegaard as he was taking care of that up to some time ago.

I am still on it. Thanks!

--

josch commented 7 years ago

I compiled from git master and was unable to reproduce the issue I saw in 0.2.3. And that is without commit d268c9b. So the fix was somewhere between 0.2.3 and d268c9b. Anyways, the issue is fixed, so lets just leave this closed.