In SQLite through 3.31.1, the ALTER TABLE implementation has a use-after-free, as demonstrated by an ORDER BY clause that belongs to a compound SELECT statement.
https://www3.sqlite.org/cgi/src/info/b64674919f673602
https://www.tenable.com/security/tns-2021-14
https://www.sqlite.org/src/info/d09f8c3621d5f7f8
https://www.oracle.com/security-alerts/cpuoct2020.html
https://www.oracle.com/security-alerts/cpujul2020.html
https://www.oracle.com/security-alerts/cpujan2021.html
https://www.oracle.com/security-alerts/cpuApr2021.html
https://security.netapp.com/advisory/ntap-20200416-0001/
https://security.gentoo.org/glsa/202007-26
https://security.FreeBSD.org/advisories/FreeBSD-SA-20:22.sqlite.asc
https://cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf