{"action":"created","issue":{"url":"https://api.github.com/repos/uNetworking/uWebSockets/issues/863","repository_url":"https://api.github.com/repos/uNetworking/uWebSockets","labels_url":"https://api.github.com/repos/uNetworking/uWebSockets/issues/863/labels{/name}","comments_url":"https://api.github.com/repos/uNetworking/uWebSockets/issues/863/comments","events_url":"https://api.github.com/repos/uNetworking/uWebSockets/issues/863/events","html_url":"https://github.com/uNetworking/uWebSockets/issues/863","id":424994762,"node_id":"MDU6SXNzdWU0MjQ5OTQ3NjI=","number":863,"title":"memset ws->getUserData() pointer causes segmentation fault in open handler.","user":{"login":"f-cg","id":31987463,"node_id":"MDQ6VXNlcjMxOTg3NDYz","avatar_url":"https://avatars1.githubusercontent.com/u/31987463?v=4","gravatar_id":"","url":"https://api.github.com/users/f-cg","html_url":"https://github.com/f-cg","followers_url":"https://api.github.com/users/f-cg/followers","following_url":"https://api.github.com/users/f-cg/following{/other_user}","gists_url":"https://api.github.com/users/f-cg/gists{/gist_id}","starred_url":"https://api.github.com/users/f-cg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f-cg/subscriptions","organizations_url":"https://api.github.com/users/f-cg/orgs","repos_url":"https://api.github.com/users/f-cg/repos","events_url":"https://api.github.com/users/f-cg/events{/privacy}","received_events_url":"https://api.github.com/users/f-cg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-03-25T16:22:13Z","updated_at":"2019-03-25T16:49:58Z","closed_at":null,"author_association":"NONE","body":"```\r\n#include \"App.h\"\r\n#include <cstdlib>\r\n\r\nint main() {\r\n    /* ws->getUserData returns one of these */\r\n    struct PerSocketData {\r\n        int a[32];\r\n    };  \r\n\r\n    /* Very simple WebSocket echo server */\r\n    uWS::App().ws<PerSocketData>(\"/*\", {\r\n        /* Settings */\r\n        .compression = uWS::SHARED_COMPRESSOR,\r\n        .maxPayloadLength = 16 * 1024,\r\n        /* Handlers */\r\n        .open = [](auto *ws, auto *req) {\r\n                auto psd=(PerSocketData*)ws->getUserData();\r\n                std::memset(psd,0,sizeof(PerSocketData));\r\n        },  \r\n        .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {\r\n            ws->send(message, opCode);\r\n        },  \r\n    }).listen(9001, [](auto *token) {\r\n        if (token) {\r\n            std::cout << \"Listening on port \" << 9001 << std::endl;\r\n        }\r\n    }).run();\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/uNetworking/uWebSockets/issues/comments/476284778","html_url":"https://github.com/uNetworking/uWebSockets/issues/863#issuecomment-476284778","issue_url":"https://api.github.com/repos/uNetworking/uWebSockets/issues/863","id":476284778,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3NjI4NDc3OA==","user":{"login":"alexhultman","id":3397140,"node_id":"MDQ6VXNlcjMzOTcxNDA=","avatar_url":"https://avatars1.githubusercontent.com/u/3397140?v=4","gravatar_id":"","url":"https://api.github.com/users/alexhultman","html_url":"https://github.com/alexhultman","followers_url":"https://api.github.com/users/alexhultman/followers","following_url":"https://api.github.com/users/alexhultman/following{/other_user}","gists_url":"https://api.github.com/users/alexhultman/gists{/gist_id}","starred_url":"https://api.github.com/users/alexhultman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexhultman/subscriptions","organizations_url":"https://api.github.com/users/alexhultman/orgs","repos_url":"https://api.github.com/users/alexhultman/repos","events_url":"https://api.github.com/users/alexhultman/events{/privacy}","received_events_url":"https://api.github.com/users/alexhultman/received_events","type":"User","site_admin":false},"created_at":"2019-03-25T16:49:58Z","updated_at":"2019-03-25T16:49:58Z","author_association":"MEMBER","body":"#859 "}}
{"actor":{"display_login":"alexhultman"}}