mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 00:55:53 +08:00
Fix CVE-2020-28591 by dropping vertices that are illegal in the facet list.
This commit is contained in:
parent
dad3b1edb9
commit
5c4747ecc7
@ -591,9 +591,14 @@ void AMFParserContext::endElement(const char * /* name */)
|
|||||||
// Faces of the current volume:
|
// Faces of the current volume:
|
||||||
case NODE_TYPE_TRIANGLE:
|
case NODE_TYPE_TRIANGLE:
|
||||||
assert(m_object && m_volume);
|
assert(m_object && m_volume);
|
||||||
m_volume_facets.push_back(atoi(m_value[0].c_str()));
|
// drop illegal vertex references.
|
||||||
m_volume_facets.push_back(atoi(m_value[1].c_str()));
|
if (strtoul(m_value[0].c_str(), nullptr, 10) < m_object_vertices.size() &&
|
||||||
m_volume_facets.push_back(atoi(m_value[2].c_str()));
|
strtoul(m_value[1].c_str(), nullptr, 10) < m_object_vertices.size() &&
|
||||||
|
strtoul(m_value[2].c_str(), nullptr, 10) < m_object_vertices.size()) {
|
||||||
|
m_volume_facets.push_back(atoi(m_value[0].c_str()));
|
||||||
|
m_volume_facets.push_back(atoi(m_value[1].c_str()));
|
||||||
|
m_volume_facets.push_back(atoi(m_value[2].c_str()));
|
||||||
|
}
|
||||||
m_value[0].clear();
|
m_value[0].clear();
|
||||||
m_value[1].clear();
|
m_value[1].clear();
|
||||||
m_value[2].clear();
|
m_value[2].clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user