[Dev-luatex] Argument checking in ltexlib.c

Hans Hagen j.hagen at xs4all.nl
Fri Aug 23 09:11:21 CEST 2019


On 8/23/2019 12:43 AM, Marcel Fabian Kr├╝ger wrote:
> Hello,
> 
> in tex_setmathparm and tex_getmathparm from ltexlib.c, `i` stores the
> index of the math parameter to query or set. Given that `i` is obtained
> through luaL_checkoption it should never have a invalid value. The
> function still check that `i` is in the valid range using the check
> 
>          if (i<0 && i>=math_param_last) {
>              /* invalid spec, just ignore it  */
> 
> I think this is a typo because i>=math_param_last (with
> math_param_last=114) implies i>0 and therefore this condition can never
> be true. Maybe || could be used instead of && or the check could be
> removed entirly.
in luametatex i use this test

         if (i < 0 || j < 0) {

so i'll do that in luatex too

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the dev-luatex mailing list