On Thu, 23 May 2002, Cliff Woolley wrote:
> (gdb) bt
> #0 match_boyer_moore_horspool (this_pattern=0x8111cf0,
> s=0x8161dc4 "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; )",
> slen=58) at apr_strmatch.c:133
> #1 0x806a616 in match_headers (r=0x8161048) at mod_setenvif.c:567
>
> (gdb) info locals
> s_tmp = 0x8161df7 ")"
> p_tmp = 0x8111ce8 "2"
> s_end = 0x8161dfe ""
> shift = (int *) 0x8111d00
> s_next = 0x8161df7 ")"
> p_start = 0x8111ce0 "Mozilla/2"
> p_end = 0x8111ce8 "2"
Okay, the while loop is definitely spinning forever:
(gdb)
122 while (s_next < s_end) {
(gdb)
123 const char *s_tmp = s_next;
(gdb)
124 const char *p_tmp = p_end;
(gdb)
125 while (*s_tmp == *p_tmp) {
(gdb)
132 s_next += shift[(int)*s_next];
(gdb)
133 }
(gdb)
122 while (s_next < s_end) {
(gdb)
123 const char *s_tmp = s_next;
(gdb)
124 const char *p_tmp = p_end;
(gdb)
125 while (*s_tmp == *p_tmp) {
(gdb)
132 s_next += shift[(int)*s_next];
(gdb)
133 }
And yes, s_next *is* less than s_end. So the question is: why doesn't
s_next get incremented?
(gdb) p *s_next
$3 = -71 ''
(gdb) p shift[*s_next]
$4 = 0
Ah. Oops.
(Note that -71 is a non-printable superscript 1 or something.)
Perhaps s_next needs to be unsigned?
--Cliff
--------------------------------------------------------------
Cliff Woolley
[EMAIL PROTECTED]
Charlottesville, VA