Skip to content

Commit d173b91

Browse files
OpenXR loader: Handle parse errors in layer implementation version
Co-authored-by: Rylie Pavlik <rylie.pavlik@collabora.com>
1 parent c3a8308 commit d173b91

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/loader/manifest_file.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,16 @@ void ApiLayerManifestFile::CreateIfValid(ManifestFileType type, const std::strin
861861
return;
862862
}
863863

864-
uint32_t implementation_version = atoi(layer_root_node["implementation_version"].asString().c_str());
864+
uint32_t implementation_version = 0;
865+
{
866+
char *end_ptr;
867+
implementation_version = strtol(layer_root_node["implementation_version"].asString().c_str(), &end_ptr, 10);
868+
if (*end_ptr != '\0') {
869+
std::ostringstream oss(error_ss.str());
870+
oss << "layer " << filename << " has invalid implementation version.";
871+
LoaderLogger::LogWarningMessage("", oss.str());
872+
}
873+
}
865874
std::string library_path = layer_root_node["library_path"].asString();
866875

867876
// If the library_path variable has no directory symbol, it's just a file name and should be accessible on the

0 commit comments

Comments
 (0)