This repository was archived by the owner on May 23, 2024. It is now read-only.

Description
Hello,
I'm having out of memory exceptions when using HTML sanitizer (version 1.3.0) on a malformed string.
php.CRITICAL: Fatal Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 352256 bytes) {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\OutOfMemoryError(code: 0): Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 352256 bytes) at /srv/web/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php:1054)"
Here is a snippet to reproduce the issue:
The message comes from a chat which truncates messages when they are too long, leading to some invalid html content. (Fun fact, this message comes from production).
<?php
/** @var SanitizerInterface $sanitizer */
$sanitizer->sanitize("<p>Apr\u00e8s s'il y a un gros bug et que tout le monde en profite, mon avis l\u00e0 dessus peut changer. Mais normalement non, pas de reset pour les joueurs arriv\u00e9s avec la beta publique.<\/p>\n\n<p>Par contre certains \u00e9quilibrages changeront, c&#");