This may prove to be a duplicate of
MDEV-17783 and/or MDEV-23937, however there is a different situation here (stack smashing). It is also unclear if the MDEV-17783 patch already made it to 10.7 trunk. A 10.7 trunk build from today still shows the issue. Finally, the versions affected look to be different.
The stack smashing may be observed only x in y runs. Ref first comment below for other related stack.
Bug confirmed present in:
MariaDB: 10.4.20 (dbg), 10.4.20 (opt), 10.5.11 (dbg), 10.5.11 (opt), 10.6.3 (dbg), 10.6.3 (opt), 10.7.0 (dbg), 10.7.0 (opt)
Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.39 (dbg), 10.2.39 (opt), 10.3.30 (dbg), 10.3.30 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt)