[tex-live] Re: [tex-implementors] Re: bug in etex

Olaf Weber olaf at infovore.xs4all.nl
Wed Jul 14 14:42:22 CEST 2004

Philip TAYLOR writes:
> Olaf Weber wrote:

>> What is null in etex in the Pascal version?  In web2c it is defined as
>> min_halfword, which is a large negative number (-@"FFFFFFF).  However,
>> in the original tex.web, min_halfword equals 0.  So the reason the
>> Pascal version doesn't trap may be that an invalid (null) cur_ptr,
>> is still a valid array index, in contrast to web2c.

> In TeX.web, NULL is @D'd to MIN_HALFWORD, which is itself @D'd to 0.
> When you say "In web2c it is defined as min_halfword", I don't think
> this is "web2c"-specific at all : it appears to derive directly from
> Knuth's canonical Pascal code.  A global search over all of the
> AXP/VMS and ETEX directories does not reveal change to tbe /status
> quo/ : both (VMS) TeX.ch and (VMS) eTeX.ch simply repeat that declaration :

True, I formulated that badly.  The definition of null remains the
same (min_halfword), but the definition of min_halfword differs, with
the result that on web2c, an access of mem[min_halfword] or
mem[min_halfword+1] often traps.

This does not happen on those systems where min_halfword is defined as
0, as mem[0] and mem[1] are valid array accesses, even if they are
semantically invalid in the code doing those accesses.

Or to put it differently: the fact that the reference implementation
on VMS didn't detect an out-of-array-bounds condition does not mean
that the code is correct, because no such condition occurs in the
failing case.

I strongly recommend inserting a trap in the location given, to verify
whether in the reference implementation we also end up "dereferencing"
a null.

@x l.2737 - guard against |sa_ptr|(|null|).
    else q:=sa_ptr(cur_ptr)
    else if cur_ptr=null then q:=null else q:=sa_ptr(cur_ptr)

Olaf Weber

               (This space left blank for technical reasons.)

More information about the tex-live mailing list