From 6ff85eebe513c8663c100c99b54e7be2296a4f61 Mon Sep 17 00:00:00 2001 From: Andrew King Date: Sat, 21 May 2022 20:23:30 -0400 Subject: [PATCH 1/3] bugfix for #2100: null-dereference in GCC 12.1.0 --- src/SFML/Network/Http.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SFML/Network/Http.cpp b/src/SFML/Network/Http.cpp index 29c2c0bc6..0a88b2429 100644 --- a/src/SFML/Network/Http.cpp +++ b/src/SFML/Network/Http.cpp @@ -261,7 +261,10 @@ void Http::Response::parse(const std::string& data) std::istreambuf_iterator it(in); std::istreambuf_iterator itEnd; for (std::size_t i = 0; ((i < length) && (it != itEnd)); i++) - m_body.push_back(*it++); + { + m_body.push_back(*it); + ++it; + } } // Drop the rest of the line (chunk-extension) From 3e424550d88ebd04c0cc49daf7be78653a57a366 Mon Sep 17 00:00:00 2001 From: Andrew King Date: Sat, 21 May 2022 23:16:40 -0400 Subject: [PATCH 2/3] Added comment for GCC 12.1 false-positive (issue #2100) --- src/SFML/Network/Http.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SFML/Network/Http.cpp b/src/SFML/Network/Http.cpp index 0a88b2429..378967912 100644 --- a/src/SFML/Network/Http.cpp +++ b/src/SFML/Network/Http.cpp @@ -263,7 +263,7 @@ void Http::Response::parse(const std::string& data) for (std::size_t i = 0; ((i < length) && (it != itEnd)); i++) { m_body.push_back(*it); - ++it; + ++it; // Iterate in separate expression to work around false positive -Wnull-dereference warning in GCC 12.1.0 } } From 97a1bf2f5dcb640ae0ce2f771b1234d1678d8db5 Mon Sep 17 00:00:00 2001 From: DanielRabl <48823338+DanielRabl@users.noreply.github.com> Date: Sun, 22 May 2022 14:47:49 +0200 Subject: [PATCH 3/3] Use wide-string character consistently Comparing '\r' against 8bit character instead of 16bit wide character. --- src/SFML/Graphics/Text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SFML/Graphics/Text.cpp b/src/SFML/Graphics/Text.cpp index d6f16317a..fe61bd650 100644 --- a/src/SFML/Graphics/Text.cpp +++ b/src/SFML/Graphics/Text.cpp @@ -447,7 +447,7 @@ void Text::ensureGeometryUpdate() const Uint32 curChar = m_string[i]; // Skip the \r char to avoid weird graphical issues - if (curChar == '\r') + if (curChar == L'\r') continue; // Apply the kerning offset