summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2018-02-09 18:36:31 -0600
committerYifan Hong2018-02-12 15:07:58 -0600
commit947570619d88bc6b9ca87f567943987f70a3905a (patch)
treeb8897fe79f35bc3b216981e4c67a8b31b2d919ad /utils.h
parent882dfe28edfc8ce8c07f71564a6b1a2097aba92f (diff)
downloadplatform-system-libvintf-947570619d88bc6b9ca87f567943987f70a3905a.tar.gz
platform-system-libvintf-947570619d88bc6b9ca87f567943987f70a3905a.tar.xz
platform-system-libvintf-947570619d88bc6b9ca87f567943987f70a3905a.zip
parse_xml.cpp: Deserilization does not touch lastError()
The global mLastError fields for each converters can potentially cause a segfault when a program with multiple threads tries to deserialize a bad file at the same time. - deserialization APIs that touches the mLastError field are marked as non-const APIs - const variants are provided (error is provided as an output parameter) - Functionalities are equivalent (tests ensure this). Test: libvintf_test Test: vintf_object_test Fixes: 71874788 Change-Id: I416de909b32809a4ac377d9da998c48d7d409457
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils.h b/utils.h
index 3779614..305a018 100644
--- a/utils.h
+++ b/utils.h
@@ -110,10 +110,10 @@ status_t fetchAllInformation(const std::string& path, const XmlConverter<T>& con
110 return result; 110 return result;
111 } 111 }
112 112
113 bool success = converter(outObject, info); 113 bool success = converter(outObject, info, error);
114 if (!success) { 114 if (!success) {
115 if (error) { 115 if (error) {
116 *error = "Illformed file: " + path + ": " + converter.lastError(); 116 *error = "Illformed file: " + path + ": " + *error;
117 } 117 }
118 return BAD_VALUE; 118 return BAD_VALUE;
119 } 119 }