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
diff --git a/utils.h b/utils.h
index 3779614..305a018 100644
--- a/utils.h
+++ b/utils.h
@@ -110,10 +110,10 @@
return result;
}
- bool success = converter(outObject, info);
+ bool success = converter(outObject, info, error);
if (!success) {
if (error) {
- *error = "Illformed file: " + path + ": " + converter.lastError();
+ *error = "Illformed file: " + path + ": " + *error;
}
return BAD_VALUE;
}