CHAR range-checking breach
Posted: Sat Sep 05, 2020 9:16 am
When range-checking is enabled, the following should produce a run-time trap 'index out of range' at (*X*) and (*XX*), but it doesn't; instead, it produces a TRAP 0, displaying that i = 65536, r = 65536.0, c = 0X, d = 0X at (*XXX*).
I think it is a small omission in PROCEDURE DevCPC486.ConvMove. 65536 should be replaced with an obvious 65535 in the lines
to fix CHR(INTEGER) range checking and
to fix CHR(ENTIER(REAL)) range checking.
I move to make this amendment.
Code: Select all
MODULE M;
PROCEDURE P*;
VAR c, d: CHAR; i: INTEGER;
BEGIN i := 65536; r := 65536;
c := CHR(i) (*X*);
d := CHR(ENTIER(r)); (*XX*);
HALT(0) (*XXX*)
END P;
END M.
(!)DevCompiler.CompileThis M+ (!) mind the plus - it enables range-checking.
Code: Select all
ELSIF f = Char16 THEN Check(y, 0, 65536)
Code: Select all
ELSIF f = Char16 THEN Check(y, 0, 65536); FreeHi(y)
I move to make this amendment.