[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: Re: [PATCH][Bug 102118] crash when a character >= 0xF0 is inserted
From: Mario Teijeiro Otero <emeteo () escomposlinux ! org>
Date: 2005-03-21 22:37:50
Message-ID: 200503212337.53853.emeteo () escomposlinux ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
Exactly, the problem is in the implementation of boyermor algorithm. Attatched
go the patch that fix.
In the tar.gz go the environment test I used to test the algorithm. Of course,
I tested it with kmail ;-)
is it ok for commit ?
Regards
["testboyermor.tar.gz" (application/x-tgz)]
["boyermor.diff" (text/x-diff)]
? test/exam
? test/examplo06.cpp
Index: boyermor.cpp
===================================================================
RCS file: /home/kde/kdepim/mimelib/boyermor.cpp,v
retrieving revision 1.14
diff -u -p -r1.14 boyermor.cpp
--- boyermor.cpp 24 May 2003 09:22:47 -0000 1.14
+++ boyermor.cpp 21 Mar 2005 22:31:35 -0000
@@ -97,9 +97,9 @@ void DwBoyerMoore::_Assign(const char* a
for (i=0; i < mPatLen-1; ++i) {
unsigned char skip = mPatLen - i - 1;
mCiPat[i] = tolower(mPat[i]);
- mCiSkipAmt[(unsigned)mCiPat[i]] = skip;
- mCiSkipAmt[(unsigned)toupper(mCiPat[i])] = skip;
- mSkipAmt[(unsigned)mPat[i]] = skip;
+ mCiSkipAmt[(unsigned char)mCiPat[i]] = skip;
+ mCiSkipAmt[(unsigned char)toupper(mCiPat[i])] = skip;
+ mSkipAmt[(unsigned char)mPat[i]] = skip;
}
mCiPat[i] = tolower(mPat[i]);
}
@@ -122,7 +122,7 @@ size_t DwBoyerMoore::FindIn(const DwStri
for (i=mPatLen-1; i < bufLen; i += skipAmt[(unsigned char)buf[i]]) {
int iBuf = i;
int iPat = mPatLen - 1;
- while (iPat >= 0 && (aCs ? buf[iBuf] : tolower(buf[iBuf])) == pat[iPat]) {
+ while (iPat >= 0 && (aCs ? ( unsigned char )buf[iBuf] : ( unsigned char ) \
tolower(buf[iBuf])) == ( unsigned char )pat[iPat]) {
--iBuf;
--iPat;
}
[Attachment #9 (application/pgp-signature)]
_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic