The CPU cannot "overheat" itself baring some catastrophic malfunction (which would be covered under warranty). Overheating implies that the cooling system as failed and the CPU will damage itself. Virtually all modern CPUs, including the M1, will throttle its clock down if temperatures reach maximum safe level. Particularly true for a CPU as new as the M1. There's simply no way you can damage your machine by running any app, regardless of how hard it works the CPU. If it gets too hot, it'll slow down until it's within parameters. That the case is warm to the touch implies the heatsink is radiating away the heat. But a case that's warm, or even hot, to the touch does not in any way indicate the machine is on the threshold of a Chernobyl-style meltdown.
Higher performance machines like the M1 MacBook Pro will have an active cooling system (i.e., a fan) to radiate heat away faster so the machine can run longer/harder without throttling down. But again, having the fan kick on at maximum RPM doesn't indicate "overheating" -- it indicates it's working as intended.
Now, if your machine is supposed to be asleep and it's actually not, that's something else entirely, and can certainly run the battery down unexpectedly, but the above remains true about the CPU. And it will almost certainly happily run at 90ºC for the entire useful life of the machine and beyond.