{"action":"created","issue":{"url":"https://api.github.com/repos/meetecho/janus-gateway/issues/165","labels_url":"https://api.github.com/repos/meetecho/janus-gateway/issues/165/labels{/name}","comments_url":"https://api.github.com/repos/meetecho/janus-gateway/issues/165/comments","events_url":"https://api.github.com/repos/meetecho/janus-gateway/issues/165/events","html_url":"https://github.com/meetecho/janus-gateway/issues/165","id":59271904,"number":165,"title":"crash with buffer overflow when sending data via data channel","user":{"login":"xenyou","id":832358,"avatar_url":"https://avatars.githubusercontent.com/u/832358?v=3","gravatar_id":"","url":"https://api.github.com/users/xenyou","html_url":"https://github.com/xenyou","followers_url":"https://api.github.com/users/xenyou/followers","following_url":"https://api.github.com/users/xenyou/following{/other_user}","gists_url":"https://api.github.com/users/xenyou/gists{/gist_id}","starred_url":"https://api.github.com/users/xenyou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xenyou/subscriptions","organizations_url":"https://api.github.com/users/xenyou/orgs","repos_url":"https://api.github.com/users/xenyou/repos","events_url":"https://api.github.com/users/xenyou/events{/privacy}","received_events_url":"https://api.github.com/users/xenyou/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2015-02-27T18:01:57Z","updated_at":"2015-03-05T16:14:18Z","closed_at":"2015-03-05T15:05:38Z","body":"I got this error when sending data via data channel.\r\n\r\n```\r\n[2860442330] Message received of length 11 on channel with id 0: hello world\r\nGot a DataChannel message (11 bytes) to forward: hello world\r\n[1362503998] SCTP data to send (11 bytes) coming from a plugin: hello world\r\nUsing label 'JanusDataChannel' (16, 16 with padding)\r\n*** buffer overflow detected ***: ./bin/janus terminated\r\n======= Backtrace: =========\r\n/lib/x86_64-linux-gnu/libc.so.6(+0x77f6f)[0x7f8f24beef6f]\r\n/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f8f24c82a7c]\r\n/lib/x86_64-linux-gnu/libc.so.6(+0x109ad0)[0x7f8f24c80ad0]\r\n./bin/janus(janus_sctp_send_open_request_message+0x55)[0x42a875]\r\n./bin/janus(janus_sctp_open_channel+0x189)[0x42ade9]\r\n./bin/janus(janus_sctp_send_data+0x130)[0x42b260]\r\n./bin/janus(janus_ice_send_thread+0x22c)[0x414e3c]\r\n/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x70925)[0x7f8f26ea3925]\r\n/lib/x86_64-linux-gnu/libpthread.so.0(+0x80a5)[0x7f8f24f430a5]\r\n/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f8f24c70cfd]\r\n======= Memory map: ========\r\n00400000-00443000 r-xp 00000000 08:01 1573835                            /opt/janus/bin/janus\r\n....\r\n```\r\n\r\nsteps to reproduce\r\n1. patch the code(below) to send data via data channel\r\n2. access video mcu demo with a browser (fireforx)\r\n3. access video mcu demo with another browser (chrome)\r\n4. wait for sending data (30sec)\r\n\r\nAdd this code to videomcutest.js to test.\r\n```\r\n                                                                },\r\n                                                                ondataopen: function() {\r\n                                                                        setTimeout(function() {\r\n                                                                        console.log('fire');\r\n                                                                        mcutest.data({\r\n                                                                                text: 'hello world'\r\n                                                                        });\r\n                                                                        }, 30000);\r\n                                                                },\r\n                                                                onmessage: function(msg, jsep) {\r\n                                                                        console.log(\" ::: Got a message (publisher) :::\");\r\n```\r\n\r\nAlso don't forget to add data:true to media object below.\r\n```\r\nfunction publishOwnFeed(useAudio) {\r\n        // Publish our stream\r\n        $('#publish').attr('disabled', true).unbind('click');\r\n        mcutest.createOffer(\r\n                {\r\n                        media: { data: true, audioRecv: false, videoRecv: false, audioSend: useAudio, videoSend: true}, // Publishers are sendonly\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/meetecho/janus-gateway/issues/comments/77393419","html_url":"https://github.com/meetecho/janus-gateway/issues/165#issuecomment-77393419","issue_url":"https://api.github.com/repos/meetecho/janus-gateway/issues/165","id":77393419,"user":{"login":"lminiero","id":3684796,"avatar_url":"https://avatars.githubusercontent.com/u/3684796?v=3","gravatar_id":"","url":"https://api.github.com/users/lminiero","html_url":"https://github.com/lminiero","followers_url":"https://api.github.com/users/lminiero/followers","following_url":"https://api.github.com/users/lminiero/following{/other_user}","gists_url":"https://api.github.com/users/lminiero/gists{/gist_id}","starred_url":"https://api.github.com/users/lminiero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lminiero/subscriptions","organizations_url":"https://api.github.com/users/lminiero/orgs","repos_url":"https://api.github.com/users/lminiero/repos","events_url":"https://api.github.com/users/lminiero/events{/privacy}","received_events_url":"https://api.github.com/users/lminiero/received_events","type":"User","site_admin":false},"created_at":"2015-03-05T16:14:18Z","updated_at":"2015-03-05T16:14:18Z","body":"That's normal: if the listener data channel is not open, then the data can obviously not be sent there. The data channel needs to be open on that side too before it can receive messages."}}