...
In particular, assertions are generally unsuitable for server programs or embedded systems. A failed assertion can lead to a denial-of-service attack if triggered by a malicious user can discover how to trigger it, such as if size
were in some way derived from client input. In such situations, a soft failure mode such as writing to a log file is more appropriate.
...