Skip to content

val() doesn't properly check range.

Original Reporter info from Mantis: marco @marcoonthegit
  • Reporter name: Marco van de Voort

Description:

Bart B. drew my attention to the following issue:

var value : word;
    code : Longint;

begin
 Val('4294901772', Value, code);
   writeln(code);
end.

returns "10" on Delphi, and "0" with a fairly recent trunk. Note the string constant is larger than 65535, the range of word.

Mantis conversion info:

  • Mantis ID: 15633
  • Version: 2.5.1
  • Monitored by: » @flyingsheep (Bart Broersma)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information