all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: infinite loop in boyer_moore()
@ 2009-04-02 22:26 Chong Yidong
  2009-04-16  4:51 ` bug#2844: " Chong Yidong
  2009-04-16  4:51 ` Chong Yidong
  0 siblings, 2 replies; 9+ messages in thread
From: Chong Yidong @ 2009-04-02 22:26 UTC (permalink / raw)
  To: emacs-devel; +Cc: 2844

> Gnus has been entering infinite loops for me while splitting mail.
> Today I got a chance to look into it.  The problem is in
> boyer_moore(), in search.c:

>     /* Use signed comparison if appropriate
>        to make cursor+infinity sure to be > p_limit.
>        Assuming that the buffer lies in a range of addresses
>        that are all "positive" (as ints) or all "negative",
>        either kind of comparison will work as long
>        as we don't step by infinity.  So pick the kind
>        that works when we do step by infinity.  */
>     if ((EMACS_INT) (p_limit + infinity) > (EMACS_INT) p_limit)
>       while ((EMACS_INT) cursor <= (EMACS_INT) p_limit)
>         cursor += BM_tab[*cursor];
>     else
>       while ((EMACS_UINT) cursor <= (EMACS_UINT) p_limit)
>         cursor += BM_tab[*cursor];

> it takes the signed (EMACS_INT) loop, but that fails because cursor is
> (unsigned char *) 0x7fffc440, whereas p_limit is (unsigned char *)
> 0x80001260.

> infinity, computed earlier in that function, is 0x37dac21, but I don't
> see how a positive value would have helped.  It seems to me that we
> have to check that we won't be crossing this boundary starting at
> cursor rather than p_limit, or maybe both.  I haven't thought much
> about it.

Checking with cursor as well as p_limit sounds about right to be, but I
am far from familiar with this part of the code.  Does anyone one this
list have an opinion?




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-04-16 13:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-02 22:26 infinite loop in boyer_moore() Chong Yidong
2009-04-16  4:51 ` bug#2844: " Chong Yidong
2009-04-16  4:51 ` Chong Yidong
2009-04-16  9:32   ` bug#2844: " Andreas Schwab
2009-04-16  9:32   ` Andreas Schwab
2009-04-16 13:42     ` Chong Yidong
2009-03-27  3:05       ` bug#2844: " Alexandre Oliva
2009-04-02  7:49         ` Andreas Schwab
2009-04-16 13:50         ` bug#2844: marked as done (infinite loop in boyer_moore()) Emacs bug Tracking System

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.