[fpc-devel] possible unicode buffer overflow

Marco van de Voort fpc at pascalprogramming.org
Fri Apr 17 18:38:53 CEST 2026


Op 17-4-2026 om 14:15 schreef Michael Van Canneyt via fpc-devel:
>>
>>
>> In order to track unfreed memory at work, I've written a custom 
>> memory manager wrapper around the default manager.
>> To be sure that the memory isn't corrupted, the returned memory 
>> blocks are surrounded by guard bytes.
>>
>> What I see when a string is released that there is no room for the 
>> trailing null. The free is triggered by FPC_UNICODESTR_DECR_REF, so I 
>> assume the extra null is somewhere written when creating the string
>
> Unicode strings are supposed to be 00 terminated, AFAIK.

Marc has already resolved it, but afaik the 3.3.1 heapmanager has more 
(fastmm like) options? Do you know if there is a description of that 
somewhere?




More information about the fpc-devel mailing list