Skip to content

Commit 0eb9ccd

Browse files
authored
Merge pull request #25 from csk-ableton/master
Fix memory corruption & slow parsing
2 parents 69a272b + 10dc45b commit 0eb9ccd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/detail/grammar.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace detail {
1717
inline bool isalnum(string_view::const_iterator &it,
1818
string_view::const_iterator last) {
1919
if (it != last) {
20-
if (std::isalnum(*it, std::locale("C"))) {
20+
if (std::isalnum(*it, std::locale::classic())) {
2121
++it;
2222
return true;
2323
}
@@ -28,7 +28,7 @@ inline bool isalnum(string_view::const_iterator &it,
2828
inline bool isdigit(string_view::const_iterator &it,
2929
string_view::const_iterator last) {
3030
if (it != last) {
31-
if (std::isdigit(*it, std::locale("C"))) {
31+
if (std::isdigit(*it, std::locale::classic())) {
3232
++it;
3333
return true;
3434
}
@@ -91,14 +91,14 @@ inline bool is_pct_encoded(string_view::const_iterator &it,
9191
}
9292
}
9393

94-
if (std::isxdigit(*it_copy, std::locale("C"))) {
94+
if (std::isxdigit(*it_copy, std::locale::classic())) {
9595
++it_copy;
9696
if (it_copy == last) {
9797
return false;
9898
}
9999
}
100100

101-
if (std::isxdigit(*it_copy, std::locale("C"))) {
101+
if (std::isxdigit(*it_copy, std::locale::classic())) {
102102
++it_copy;
103103
it = it_copy;
104104
return true;

src/uri.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ uri &uri::operator=(uri other) {
195195

196196
void uri::swap(uri &other) noexcept {
197197
uri_.swap(other.uri_);
198-
uri_view_.swap(other.uri_view_);
198+
uri_view_ = uri_;
199+
other.uri_view_ = other.uri_;
199200

200201
const auto this_parts = uri_parts_;
201202
detail::advance_parts(uri_view_, uri_parts_, other.uri_parts_);

0 commit comments

Comments
 (0)