فهرست منبع

* fixed crash on systems which properly protect read-only data
+ added check for string which only consists of #0 (should fail, does not)

git-svn-id: trunk@6636 -

Jonas Maebe 18 سال پیش
والد
کامیت
2a2679b951
1فایلهای تغییر یافته به همراه18 افزوده شده و 1 حذف شده
  1. 18 1
      tests/webtbs/tw8177.pp

+ 18 - 1
tests/webtbs/tw8177.pp

@@ -755,9 +755,13 @@ function Validate28 : Boolean;
 const
  VALIDATENO : Cardinal = 28;
 
+var
+  c: char;
 begin
   WriteLn('Validate28');
- GlobalStrValidate28 := #0;
+ c:=#0;
+ // make sure the statement after this does not write to a read-only location
+ GlobalStrValidate28 := c;
  PInteger(Integer(GlobalStrValidate28)-4)^ := 0; //Set Length to 0
  try
   StrToInt(GlobalStrValidate28);
@@ -1354,6 +1358,19 @@ const
 
 begin
   WriteLn('Validate42');
+ Result := False;
+ try
+   S := #0;
+   I := StrToInt(S);
+ except
+  Result := True;
+ end;
+ if not Result then
+   begin
+     Writeln('#0 is not recognized as an invalid integer');
+     halt(1);
+   end;
+
  try
   Result := True;
   S := '0'#0;