vinipsmaker / tufao

An asynchronous web framework for C++ built on top of Qt

Home Page:http://vinipsmaker.github.io/tufao/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Forbinn opened this issue · comments

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,

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