[tex-k] [WEB] Possible range error in WEAVE.WEB

Andreas Scherer andreas_tex at freenet.de
Fri Aug 6 08:37:07 CEST 2021

Dear all,

I believe that line 4663 of WEAVE.WEB (definition of procedure 
'unbucket' in module 249) should be changed as follows:

   begin if sort_ptr>max_sorts then overflow('sorting');
   begin if sort_ptr=max_sorts then overflow('sorting');

(1) The Free Pascal compiler (version 3.2.2 on MacOS 11) issues a 
warning that a 'Comparison might be always false' and that the 
conditional code might not be reachable.

(2) 'sort_ptr' is, in fact, defined -- via WEB's '@d' directive -- as 
'sort_ptr: 0..max_sorts'.

(3) CWEB's cweave.w correctly checks 'scrt_ptr>=scrap_info_end' in 
similar code.

(4) Other index variables (xref_tr, module_count, stack_ptr) are checked 
with '=' against their maximal value before the next 'incr(...)'.

Stay safe!

More information about the tex-k mailing list.