SynEdit: infinite loop in TSynCustomExporter.ExportRange
- Lazarus/FPC Version: Lazarus 3.99 (rev main_3_99-1906-gfcaca1fe6a) FPC 3.3.1 i386-win32-win32/win64
What happens
The TSynCustomExporter.ExportRange method may enter an infinite loop if currently retrieved token is empty. An empty token can mean a change in range state, which requires next token to be retrieved.
In addition, increase of variable X is performed after checking whether token is empty, because otherwise the one character of token may be omitted.
I attach an example and a proposed solution.
synexp_infiniloop.patch project1.zip
Steps to reproduce
Run the attached project and click the "Export" button.