Subject: lib/638: Boyer-Moore functions match spuriously
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: David Jones <dej@torfree.net>
List: netbsd-bugs
Date: 12/11/1994 22:20:07
>Number:         638
>Category:       lib
>Synopsis:       Boyer-Moore string functions match spuriously
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 11 22:20:04 1994
>Originator:     David Jones
>Organization:
"	None"
>Release:        1.0
>Environment:
System: NetBSD qpoint 1.0A NetBSD 1.0A (QPOINT) #2: Sat Dec 10 22:23:53 EST 1994 dej@qpoint:/local/src/sys.941204/arch/amiga/compile/QPOINT amiga


>Description:
	The Boyer-Moore string matching functions will sometimes signal a match even
	where no match exists.
>How-To-Repeat:
Script started on Sun Dec 11 21:37:22 1994
/home/dej/fff> cat bm.c
#include <sys/types.h>
#include <bm.h>

void main(int argc, char *argv[])
{
bm_pat *pat;

    pat = bm_comp(argv[1], strlen(argv[1]), 0);
    if (bm_exec(pat, argv[2], strlen(argv[2]))) {
        printf("Found.\n");
    }
    bm_free(pat);
}


/home/dej/fff> bm stoo stoodley -- case 1
Found.
/home/dej/fff> bm stoo stodgfg -- case 2
/home/dej/fff> bm stoo johnston -- case 3
Found.
/home/dej/fff> bm stoo ostodgfg -- case 4
/home/dej/fff> bm stoh johnston -- case 5
Found.
/home/dej/fff> bm stoh johnmston -- case 6
/home/dej/fff> exit

Cases 1, 2, 4 and 6 are correct.
Cases 3 and 5 are not.

>Fix:
	None known
>Audit-Trail:
>Unformatted: