vinipsmaker / tufao

An asynchronous web framework for C++ built on top of Qt
http://vinipsmaker.github.io/tufao/
GNU Lesser General Public License v2.1
589 stars 179 forks source link

SIGSEGV when using int HttpServerRequestRouter::map(std::initializer_list<Mapping> map) #86

Closed Forbinn closed 8 years ago

Forbinn commented 8 years ago

Hello,

I got a segmentation fault every time I use the HttpServerRequestRouter::map function (the version that takes an initializer_list as parameter). After looking at the implementation of the code I saw that std::copy was used but in the wrong way: std::copy(std::begin(map), std::end(map), std::end(priv->mappings)); Indeed a good version should be: std::copy(std::begin(map), std::end(map), std::back_inserter(priv->mappings));

You can look at the cplusplus.com reference: http://www.cplusplus.com/reference/iterator/back_inserter/

Regards,

vinipsmaker commented 8 years ago

You're right. Thanks for the report. I may deliver a fix and a new version on the weekend.