[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3-0' - wsd/FileServer.cpp
Pranav Kant
pranavk at collabora.co.uk
Mon Dec 18 15:20:03 UTC 2017
wsd/FileServer.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 75c2147b7f774afccf55bb93f7fae79efb615361
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Mon Dec 18 19:18:43 2017 +0530
Explicit is better than implicit; avoid invalid mem access
The form.get function is something like this:
const std::string& get(const std::string& abc) { return abc; }
passing a string literal implicitly gets converted to temporary
std::string whose reference is then returned and used. This causes
crash, atleast for me, on building online with GCC 7
Change-Id: I09d0aeea57a3dbeeefd1bb28ff645723714aa6b4
Reviewed-on: https://gerrit.libreoffice.org/46727
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index a0e74a2c..501966ba 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -439,10 +439,10 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
std::string preprocess = *getUncompressedFile(relPath);
HTMLForm form(request, message);
- const std::string& accessToken = form.get("access_token", "");
- const std::string& accessTokenTtl = form.get("access_token_ttl", "");
+ const std::string accessToken = form.get("access_token", "");
+ const std::string accessTokenTtl = form.get("access_token_ttl", "");
LOG_TRC("access_token=" << accessToken << ", access_token_ttl=" << accessTokenTtl);
- const std::string& accessHeader = form.get("access_header", "");
+ const std::string accessHeader = form.get("access_header", "");
LOG_TRC("access_header=" << accessHeader);
// Escape bad characters in access token.
More information about the Libreoffice-commits
mailing list