lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

The following function is from lstrlib.c


static const char *max_expand (MatchState *ms, const char *s,

                                 const char *p, const char *ep) {

  ptrdiff_t i = 0;  /* counts maximum expand for item */

  while ((s+i)<ms->src_end && singlematch(uchar(*(s+i)), p, ep))


  /* keeps trying to match with the maximum repetitions */

  while (i>=0) {

    const char *res = match(ms, (s+i), ep+1);

    if (res) return res;

    i--;  /* else didn't match; reduce 1 repetition to try again */


  return NULL;



On our system, ptrdiff_t is unsigned long.  Therefore i>=0 is always true  and the function never returns.


Any ideas?




This e-mail and any files transmitted with it ("E-mail") is intended solely for the addressee(s)
and may contain confidential and/or legally privileged information. If you are not the addressee(s), any
disclosure, reproduction, copying, distribution or other use of the E-mail is prohibited. If you have received
this E-mail in error, please delete it and notify the sender immediately via our switchboard or return e-mail.

Neither the company nor any subsidiary or affiliate or associated company nor any individual sending this E-mail
accepts any liability in respect of the content (including errors and omissions) nor shall this e-mail be deemed
to enter the company or any subsidiary or affiliate or associated company into a contract or to create any
legally binding obligations unless expressly agreed to in writing under separate cover and timeliness of the
E-mail which arise as a result of transmission. If verification is required, please request a hard copy version
from the sender.