commit ec6c7ea: [Fix] Avoid dangling reference
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Aug 31 10:14:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-08-31 11:08:09 +0100
URL: https://github.com/rspamd/rspamd/commit/ec6c7eada0d14e8dac5f5bf3dcc95fc31fd696a2 (HEAD -> master)
[Fix] Avoid dangling reference
Issue: #3871
---
src/libserver/css/css_tokeniser.cxx | 2 +-
src/libserver/css/css_tokeniser.hxx | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/libserver/css/css_tokeniser.cxx b/src/libserver/css/css_tokeniser.cxx
index 2391140dd..dc570d64b 100644
--- a/src/libserver/css/css_tokeniser.cxx
+++ b/src/libserver/css/css_tokeniser.cxx
@@ -423,7 +423,7 @@ auto css_tokeniser::next_token(void) -> struct css_parser_token
{
/* Check pushback queue */
if (!backlog.empty()) {
- auto tok = std::move(backlog.front());
+ auto tok = backlog.front();
backlog.pop_front();
return tok;
diff --git a/src/libserver/css/css_tokeniser.hxx b/src/libserver/css/css_tokeniser.hxx
index 021284989..36ab33d8a 100644
--- a/src/libserver/css/css_tokeniser.hxx
+++ b/src/libserver/css/css_tokeniser.hxx
@@ -31,6 +31,7 @@ namespace rspamd::css {
struct css_parser_token_placeholder {}; /* For empty tokens */
struct css_parser_token {
+
enum class token_type : std::uint8_t {
whitespace_token,
ident_token,
@@ -97,6 +98,7 @@ struct css_parser_token {
explicit css_parser_token(token_type type, const value_type &value) :
value(value), type(type) {}
css_parser_token(css_parser_token &&other) = default;
+ css_parser_token(const css_parser_token &token) = default;
auto operator=(css_parser_token &&other) -> css_parser_token& = default;
auto adjust_dim(const css_parser_token &dim_token) -> bool;
More information about the Commits
mailing list