sigsegv in fpc_ansistr_append_shortstring when both arguments are ''
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
The problem seems to be the last line of code in fpc_ansistring_append_shortstring:
Procedure fpc_ansistr_append_shortstring(Var S : AnsiString;Str : ShortString); [Public,Alias : 'FPC_ANSISTR_APPEND_SHORTSTRING']; {$ifdef hascompilerproc} compilerproc; {$endif}
var
ofs : SizeInt;
begin
ofs:=Length(S);
SetLength(S,ofs+length(Str));
move(Str[1],S[ofs+1],length(Str));
PByte(Pointer(S)+length(S))^:=0; { Terminating Zero }
end;
It doesn't check S for being having length 0 (which means S is a nil pointer)
I do not have this problem with 1.0.10, but I do have it with 1.9.4 and 1.9.5.
Additional information:
Reporter: Bram Kuijvenhoven
EMail: kuifware at hotmail dot com
Mantis conversion info:
- Mantis ID: 5418
- OS: All
- Version: 1.9.5
- Fixed in version: 1.9.5