We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When passing a nullptr as second argument (http_resource* hrm) to webserver::register_resource() the application will segfault at runtime.
nullptr
http_resource* hrm
webserver::register_resource()
std::unique_ptr
httpserver::http_resource
httpserver::webserver::register_resource()
Expected behavior: not sure, maybe some kind of parameter check by httpserver::webserver::register_resource()
Actual behavior: the webserver crashes with segfault at runtime
Reproduces how often: always
class file_response_resource : public httpserver::http_resource { public: file_response_resource( std::string filename ) : filename(filename) { printf( "file_response resource created with filename: %s", filename.c_str() ); }; const std::shared_ptr<httpserver::http_response> render_GET( const httpserver::http_request& ); private: std::string filename; }; const std::shared_ptr<httpserver::http_response> file_response_resource::render_GET( const httpserver::http_request& ) { return std::shared_ptr<httpserver::file_response>( new httpserver::file_response(filename, 200, "text/plain") ); } int main( int argc, char *argv[] ) { httpserver::webserver ws = httpserver::create_webserver(8080); std::unique_ptr<file_response_resource> frr; // forget to init frr here // frr.reset(new file_response_resource(argv[1])); // accidentally pass a nullptr here ws.register_resource("/file", frr.get(), true); ws.start(true); return 0; }
The text was updated successfully, but these errors were encountered:
etr
No branches or pull requests
Prerequisites
Description
When passing a
nullptr
as second argument (http_resource* hrm
) towebserver::register_resource()
the application will segfault at runtime.Steps to Reproduce
std::unique_ptr
to a class derived fromhttpserver::http_resource
httpserver::webserver::register_resource()
the usual wayExpected behavior: not sure, maybe some kind of parameter check by
httpserver::webserver::register_resource()
Actual behavior: the webserver crashes with segfault at runtime
Reproduces how often: always
Versions
Additional Information
The text was updated successfully, but these errors were encountered: