commit 07d4d68: [Minor] Try to fix potential off-by-one error

Vsevolod Stakhov vsevolod at rspamd.com
Thu Nov 17 23:56:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-11-17 23:51:46 +0000
URL: https://github.com/rspamd/rspamd/commit/07d4d686517add3981792478907cb78810510881 (HEAD -> master)

[Minor] Try to fix potential off-by-one error

---
 src/libserver/css/css_tokeniser.cxx | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/libserver/css/css_tokeniser.cxx b/src/libserver/css/css_tokeniser.cxx
index 737b3460d..ace94cae2 100644
--- a/src/libserver/css/css_tokeniser.cxx
+++ b/src/libserver/css/css_tokeniser.cxx
@@ -441,6 +441,11 @@ auto css_tokeniser::next_token(void) -> struct css_parser_token
 		auto i = offset;
 		auto nested = 0;
 
+		if (input.empty()) {
+			/* Nothing to consume */
+			return;
+		}
+
 		/* We handle nested comments just because they can exist... */
 		while (i < input.size() - 1) {
 			auto c = input[i];


More information about the Commits mailing list