Bump sym file version and add a couple sanity checks.

Bumping the version forces regeneration of any sym files created by old ORCA/C versions with the bug that was just fixed.

A couple sanity checks are also introduced when reading sym files, including one that would have caught that bug.
This commit is contained in:
Stephen Heumann 2018-09-15 00:42:05 -05:00
parent 62757acdb1
commit 411f911b60
2 changed files with 13 additions and 1 deletions

View File

@ -942,6 +942,7 @@ case errnum of {print the error}
9 : msg := concat('Error writing ', objFile.theString.theString);
10: msg := 'ORCA/C requires version 2.0 or later of the shell';
11: msg := 'The program is too large to compile to memory -- use Compile to Disk';
12: msg := 'Invalid sym file detected. Re-run ORCA/C to proceed.';
otherwise: begin
msg := '';
Error(57);

View File

@ -18,7 +18,7 @@ uses CCommon, MM, Scanner, Symbol, CGI;
{$segment 'SCANNER'}
const
symFileVersion = 2; {version number of .sym file format}
symFileVersion = 3; {version number of .sym file format}
var
inhibitHeader: boolean; {should .sym includes be blocked?}
@ -1647,6 +1647,7 @@ var
1: begin {read a type displacement}
tdisp := typeDispList;
disp := ReadLong;
tp := nil;
while tdisp <> nil do
if tdisp^.saveDisp = disp then begin
tp := tdisp^.tPtr;
@ -1654,6 +1655,11 @@ var
end {if}
else
tdisp := tdisp^.next;
if tp = nil then begin
PurgeSymbols;
DestroySymbolFile;
TermError(12);
end; {if}
end; {case 1}
2: tp := bytePtr;
@ -1876,6 +1882,11 @@ if not ignoreSymbols then begin
end; {while}
DisposeTypeDispList;
saveSource := false;
if ord4(symPtr) > ord4(symEndPtr) then begin
PurgeSymbols;
DestroySymbolFile;
TermError(12);
end; {if}
end {if}
else begin
PurgeSymbols; {no file found}