From 7b7fc09d1fc3d9a970b2123bc41c4d1fbcff35d6 Mon Sep 17 00:00:00 2001 From: Alessio Quaglino Date: Tue, 8 Nov 2022 09:04:42 -0800 Subject: [PATCH] Raise error if an invalid curve is specified for the cable composite. PiperOrigin-RevId: 486967001 Change-Id: I7220966e172400542417d8f715dbee0c0f154d9b --- src/xml/xml_native_reader.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/xml/xml_native_reader.cc b/src/xml/xml_native_reader.cc index 629fef6a..9aba1b76 100644 --- a/src/xml/xml_native_reader.cc +++ b/src/xml/xml_native_reader.cc @@ -1911,6 +1911,9 @@ void mjXReader::OneComposite(XMLElement* elem, mjCBody* pbody, mjCDef* def) { int i = 0; while (iss) { iss >> text; + if (i>2) { + throw mjXError(elem, "The curve array must have a maximum of 3 components"); + } comp.curve[i++] = (mjtCompShape)FindKey(shape_map, mjNCOMPSHAPES, text); if (iss.eof()){ break;