Skip to content

Commit 357ea02

Browse files
saran-tcopybara-github
authored andcommitted
Remove unconditional mj_markStack in mjv_addGeoms.
Prior to commit 3f855f3, calling `mjv_updateScene` and `mjv_updateSceneFromState` on an "empty" `mjData` (one without a buffer but where all sizes are also zero) was a valid operation. The `mj_markStack` call requires free stack space, so a call to `mjv_addGeoms` on an empty `mjData` results in a stack overflow whenever `mjVIS_TENDON` is enabled. Fixes #2305. PiperOrigin-RevId: 713418586 Change-Id: I99b5de23fe94ba9aa86eeef0700c891976c9aecc
1 parent f912e8d commit 357ea02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/engine/engine_vis_visualize.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ void mjv_addGeoms(const mjModel* m, mjData* d, const mjvOption* vopt,
17281728
// spatial tendons
17291729
objtype = mjOBJ_TENDON;
17301730
category = mjCAT_DYNAMIC;
1731-
if (vopt->flags[mjVIS_TENDON] && (category & catmask)) {
1731+
if (vopt->flags[mjVIS_TENDON] && (category & catmask) && m->ntendon) {
17321732
// mark actuated tendons
17331733
mj_markStack(d);
17341734
int* tendon_actuated = mjSTACKALLOC(d, m->ntendon, int);

0 commit comments

Comments
 (0)