From: Michael Rash <mbr@cipherdyne.org>
To: Patrick McHardy <kaber@trash.net>
Cc: Michael Rash <mbr@cipherdyne.org>,
netfilter-devel@lists.netfilter.org,
Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: [PATCH] Boyer Moore textsearch bug fix
Date: Thu, 17 Aug 2006 10:46:54 -0400 [thread overview]
Message-ID: <20060817144654.GA7849@minastirith> (raw)
In-Reply-To: <44E47182.7010901@trash.net>
On Aug 17, 2006, Patrick McHardy wrote:
> Michael Rash wrote:
> > --- linux-2.6.17.8/lib/ts_bm.c.orig 2006-08-16 21:17:38.000000000 -0400
> > +++ linux-2.6.17.8/lib/ts_bm.c 2006-08-16 21:17:56.000000000 -0400
> > @@ -151,8 +151,8 @@
> > bm = ts_config_priv(conf);
> > bm->patlen = len;
> > bm->pattern = (u8 *) bm->good_shift + prefix_tbl_len;
> > - compute_prefix_tbl(bm, pattern, len);
> > memcpy(bm->pattern, pattern, len);
> > + compute_prefix_tbl(bm, pattern, len);
>
>
> Good catch, thanks. But since both pattern and len are also passed
> to compute_prefix_tbl as arguments, I think we should either make
> it use only those arguments, or remove those arguments and use only
> the values from struct ts_bm.
>
> Please send a new patch and add a Signed-off-by line so I can
> apply it. Thanks.
Got it. Here is a new patch. Thanks.
--Mike
Signed-off-by: Michael Rash <mbr@cipherdyne.org>
--- linux-2.6.17.8/lib/ts_bm.c.orig 2006-08-16 21:17:38.000000000 -0400
+++ linux-2.6.17.8/lib/ts_bm.c 2006-08-17 10:35:25.000000000 -0400
@@ -112,15 +112,14 @@
return ret;
}
-static void compute_prefix_tbl(struct ts_bm *bm, const u8 *pattern,
- unsigned int len)
+static void compute_prefix_tbl(struct ts_bm *bm)
{
int i, j, g;
for (i = 0; i < ASIZE; i++)
- bm->bad_shift[i] = len;
- for (i = 0; i < len - 1; i++)
- bm->bad_shift[pattern[i]] = len - 1 - i;
+ bm->bad_shift[i] = bm->patlen;
+ for (i = 0; i < bm->patlen - 1; i++)
+ bm->bad_shift[bm->pattern[i]] = bm->patlen - 1 - i;
/* Compute the good shift array, used to match reocurrences
* of a subpattern */
@@ -151,8 +150,8 @@
bm = ts_config_priv(conf);
bm->patlen = len;
bm->pattern = (u8 *) bm->good_shift + prefix_tbl_len;
- compute_prefix_tbl(bm, pattern, len);
memcpy(bm->pattern, pattern, len);
+ compute_prefix_tbl(bm);
return conf;
}
next prev parent reply other threads:[~2006-08-17 14:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-17 3:16 [PATCH] Boyer Moore textsearch bug fix Michael Rash
2006-08-17 13:39 ` Patrick McHardy
2006-08-17 14:25 ` Pablo Neira Ayuso
2006-08-17 14:27 ` Patrick McHardy
2006-08-17 14:46 ` Michael Rash [this message]
2006-08-17 15:43 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060817144654.GA7849@minastirith \
--to=mbr@cipherdyne.org \
--cc=kaber@trash.net \
--cc=netfilter-devel@lists.netfilter.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.