java/src/org/openantivirus/engine/censor/matcharray MatchArray.java,1.2,1.3 MatchArrayCensor.java,1.4,1.5
Kurt Huwig <[email protected]> Sat, 22 May 2004 12:22:29 +0000
| Newsgroups | gmane.comp.security.virus.openantivirus.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/openantivirus/java/src/org/openantivirus/engine/censor/matcharray
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9747/src/org/openantivirus/engine/censor/matcharray
Modified Files:
MatchArray.java MatchArrayCensor.java
Log Message:
Bugfix: some patterns were not detected due to bad optimizing
Speed improvements on multipart patterns
Index: MatchArray.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/engine/censor/matcharray/MatchArray.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- MatchArray.java 20 May 2004 13:43:17 -0000 1.2
+++ MatchArray.java 22 May 2004 12:22:27 -0000 1.3
@@ -47,8 +47,9 @@
if (abPattern.length < MINIMUM_LENGTH) {
throw new IllegalArgumentException("String too short");
}
- final int match = ((abPattern[0] & 0xff) << 8)
- | (abPattern[1] & 0xff);
+
+ final int match = ((abPattern[0] << 8)
+ | (abPattern[1] & 0xff)) & 0xffff;
Collection colMatch = colMatches[match];
if (colMatch == null) {
Index: MatchArrayCensor.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/engine/censor/matcharray/MatchArrayCensor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- MatchArrayCensor.java 20 May 2004 13:34:33 -0000 1.4
+++ MatchArrayCensor.java 22 May 2004 12:22:27 -0000 1.5
@@ -79,10 +79,16 @@
match = abBuffer[0] & 0xff;
if (iLength < abBuffer.length) {
- update(entry, 1L, abBuffer, 0, iLength, 0, 0);
+ update(entry, 1L, abBuffer, 1, iLength - 1, 1, 0);
} else {
- update(entry, 1L, abBuffer, 0, 2 * BUFFER_SIZE, 0, BUFFER_SIZE);
+ update(entry,
+ 1L,
+ abBuffer,
+ 1,
+ 2 * BUFFER_SIZE - 1,
+ 1,
+ BUFFER_SIZE - 1);
long fileOffset = 2 * BUFFER_SIZE;
int iBufferPos = 2 * BUFFER_SIZE;
@@ -137,8 +143,8 @@
final int scanLength = iOffset + iLength;
final int postfix = scanLength + iSuffix;
for (int i = iOffset; i < scanLength; i++) {
- match = ((match << 8) | ab[i]) & 0xffff;
-
+ match = ((match << 8) | (ab[i] & 0xff)) & 0xffff;
+
final PositionFoundListener[] matchListener = matchArray[match];
if (matchListener != null) {
final int iPosition = i - 1;
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click