[fpc-devel] double free of internal temp string with fpc 3.2.0
Martin Frb
lazarus at mfriebe.de
Sat Jan 9 17:15:22 CET 2021
On 08/01/2021 17:11, Martin Frb via fpc-devel wrote:
> I only tested with 3.2.0 so far. Maybe someone recalls if this is
> fixed or not.
>
> Also because it seems to happen only in very rare conditions, it may
> be that trunk does not cause it in this place even if the bug is not
> yet fixed. (as other code changes could simply change the context
> enough to mitigate it)
I was able to reproduce with a "smaller" example (do not judge the
quality of the example please, I just cut it out of the bigger LCL code....)
It appears to give the same error with 3.2.0
The error appears fixed in trunk.
Both the example and the IDE run without error, if build with fpc trunk
(and also fpc 3.0.4).
However some error (albeit in different locations, yet also freeing
strings that are in use), still happens in 3.2.1 fixes.
Tested with the test project / I have not checked the entire IDE against
3.2.1.
I have therefore reported the issue, so whatever un-merged fixes exist
in trunk can be merged.
https://bugs.freepascal.org/view.php?id=38337
-----------
I am aware the test code heavily plays with "const param: string", and
the dangers of that construct.
However the string passed as "const arg" is kept unmodified in the
caller, and not modified by any of the callees either.
-----------
On Windows the example also produces errors, however the errors manifest
different from those on Linux.
I have only tested with 3.2.0 on Windows. Since there is no valgrind on
windows, I only can see the output.
Strings passed to GetCodePoint are corrupted (or getting corrupted on
"result := '';" ?)
More information about the fpc-devel
mailing list