[fpc-devel] sysstr patch

petr.kristan at epos.cz petr.kristan at epos.cz
Fri Apr 4 19:33:42 CEST 2008


Hi.

Sysstr comparing routines does not work correct if two strings were
empty. Example:

program comp;
uses
   SysUtils;
var
  a, b: array[0..1] of char;
begin
  a[0] := #0;
  a[1] := #1;
  b[0] := #0;
  b[1] := #0;
  writeln(AnsiStrComp(a, b)=0); // '',''=0
end

This program returns false and theoreticaly repeat..until may SIGSEGV
because overflows empty PChar boundary after first cycle.

Patch is in the attachment.

Petr

-- 
Ing. Petr Kristan
.
EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
tel: +420 466335223    Czech Republic (Eastern Europe) 
fax: +420 466510709
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p
Type: text/x-pascal
Size: 1724 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20080404/ffb5c55f/attachment.p>


More information about the fpc-devel mailing list