This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/12092] strstr broken for some inputs on pre-SSE4 machines
- From: "eblake at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Tue, 5 Oct 2010 22:10:34 +0000
- Subject: [Bug libc/12092] strstr broken for some inputs on pre-SSE4 machines
- Auto-submitted: auto-generated
- References: <bug-12092-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=12092
--- Comment #5 from Eric Blake <eblake at redhat dot com> 2010-10-05 22:10:16 UTC ---
Your test for (memory > shift) will never be reached. Other than the
assignment added by your proposed patch, memory is only ever assigned to be 0
or needle_len - period. And for a periodic needle, shift is either needle_len
or < period, by virtue of how the shift table is constructed. Therefore, if
memory is non-zero but shift >= period, then shift is necessarily > memory at
that point.
Which means your code can be reduced to this simpler patch:
diff --git i/string/str-two-way.h w/string/str-two-way.h
index 502af47..76044b3 100644
--- i/string/str-two-way.h
+++ w/string/str-two-way.h
@@ -350,8 +350,8 @@ two_way_long_needle (const unsigned char *haystack,
a byte out of place, there can be no match until
after the mismatch. */
shift = needle_len - period;
- memory = 0;
}
+ memory = 0;
j += shift;
continue;
}
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.