summaryrefslogtreecommitdiff
path: root/user/clucene/static-fixes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/clucene/static-fixes.patch')
-rw-r--r--user/clucene/static-fixes.patch191
1 files changed, 0 insertions, 191 deletions
diff --git a/user/clucene/static-fixes.patch b/user/clucene/static-fixes.patch
deleted file mode 100644
index 8e80e81af..000000000
--- a/user/clucene/static-fixes.patch
+++ /dev/null
@@ -1,191 +0,0 @@
-From 6e04e9db12d0696dcd3dcc40ec61615fa5762592 Mon Sep 17 00:00:00 2001
-From: Anton Bannikov <Anton.Bannikov@Kaspersky.com>
-Date: Thu, 1 Sep 2022 16:48:07 +0300
-Subject: [PATCH] [svace] fix errors found by svace static analyzer
-
----
- src/core/CLucene/debug/error.cpp | 12 ++++++++++
- src/core/CLucene/debug/error.h | 1 +
- src/core/CLucene/index/TermInfosReader.cpp | 28 ++++++++++++----------
- src/core/CLucene/search/MultiSearcher.cpp | 24 ++++++++++++-------
- src/core/CLucene/util/_MD5Digester.h | 1 -
- src/shared/CLucene/util/StringBuffer.cpp | 25 ++++++++++---------
- 6 files changed, 57 insertions(+), 34 deletions(-)
-
-diff --git a/src/core/CLucene/debug/error.cpp b/src/core/CLucene/debug/error.cpp
-index 9b4fe3ee..e661cb86 100644
---- a/src/core/CLucene/debug/error.cpp
-+++ b/src/core/CLucene/debug/error.cpp
-@@ -46,6 +46,18 @@ CL_NS_USE(util)
- }
- #endif
-
-+ CLuceneError& CLuceneError::operator=(const CLuceneError& other)
-+ {
-+ if (&other != this)
-+ {
-+ _awhat = STRDUP_AtoA(other._awhat);
-+ _twhat = STRDUP_TtoT(other._twhat);
-+ error_number = other.error_number;
-+ }
-+
-+ return *this;
-+ }
-+
- CLuceneError::CLuceneError(const CLuceneError& clone)
- {
- this->error_number = clone.error_number;
-diff --git a/src/core/CLucene/debug/error.h b/src/core/CLucene/debug/error.h
-index 9fe980fa..62da1e62 100644
---- a/src/core/CLucene/debug/error.h
-+++ b/src/core/CLucene/debug/error.h
-@@ -70,6 +70,7 @@ class CLUCENE_EXPORT CLuceneError
- public:
- CLuceneError();
- CLuceneError(const CLuceneError& clone);
-+ CLuceneError& operator=(const CLuceneError&);
- #ifndef _ASCII
- CLuceneError(int num, const char* str, bool ownstr);
- #endif
-diff --git a/src/core/CLucene/index/TermInfosReader.cpp b/src/core/CLucene/index/TermInfosReader.cpp
-index 6ede797a..87e3bd83 100644
---- a/src/core/CLucene/index/TermInfosReader.cpp
-+++ b/src/core/CLucene/index/TermInfosReader.cpp
-@@ -26,7 +26,7 @@ CL_NS_DEF(index)
-
-
- TermInfosReader::TermInfosReader(Directory* dir, const char* seg, FieldInfos* fis, const int32_t readBufferSize):
-- directory (dir),fieldInfos (fis), indexTerms(NULL), indexInfos(NULL), indexPointers(NULL), indexDivisor(1)
-+ directory (dir),fieldInfos (fis), indexTerms(NULL), indexInfos(NULL), indexPointers(NULL), indexDivisor(1), indexTermsLength(0)
- {
- //Func - Constructor.
- // Reads the TermInfos file (.tis) and eventually the Term Info Index file (.tii)
-@@ -172,18 +172,20 @@ CL_NS_DEF(index)
-
- SegmentTermEnum* enumerator = getEnum();
-
-- if (
-- enumerator != NULL //an enumeration exists
-- && enumerator->term(false) != NULL // term is at or past current
-- && position >= enumerator->position
-- && position < (enumerator->position + totalIndexInterval)
-- )
-- {
-- return scanEnum(position); // can avoid seek
-- }
--
-- //random-access: must seek
-- seekEnum(position / totalIndexInterval);
-+ if (enumerator != NULL) //an enumeration exists
-+ {
-+ if (
-+ enumerator->term(false) != NULL // term is at or past current
-+ && position >= enumerator->position
-+ && position < (enumerator->position + totalIndexInterval)
-+ )
-+ {
-+ return scanEnum(position); // can avoid seek
-+ }
-+
-+ //random-access: must seek
-+ seekEnum(position / totalIndexInterval);
-+ }
-
- //Get the Term at position
- return scanEnum(position);
-diff --git a/src/core/CLucene/search/MultiSearcher.cpp b/src/core/CLucene/search/MultiSearcher.cpp
-index 0f2a6862..1f8e99c6 100644
---- a/src/core/CLucene/search/MultiSearcher.cpp
-+++ b/src/core/CLucene/search/MultiSearcher.cpp
-@@ -207,16 +207,22 @@ CL_NS_DEF(search)
- _CLDELETE(docs);
- }
-
-- int32_t hqlen = hq->size();
-- fieldDocs = _CL_NEWARRAY(FieldDoc*,hqlen);
-- for (j = hqlen - 1; j >= 0; j--) // put docs in array
-- fieldDocs[j] = hq->pop();
--
-- SortField** hqFields = hq->getFields();
-- hq->setFields(NULL); //move ownership of memory over to TopFieldDocs
-- _CLDELETE(hq);
-+ TopFieldDocs* pResult = NULL;
-+ if (hq)
-+ {
-+ int32_t hqlen = hq->size();
-+ fieldDocs = _CL_NEWARRAY(FieldDoc*,hqlen);
-+ for (j = hqlen - 1; j >= 0; j--) // put docs in array
-+ fieldDocs[j] = hq->pop();
-+
-+ SortField** hqFields = hq->getFields();
-+ hq->setFields(NULL); //move ownership of memory over to TopFieldDocs
-+ _CLDELETE(hq);
-+
-+ pResult = _CLNEW TopFieldDocs (totalHits, fieldDocs, hqlen, hqFields);
-+ }
-
-- return _CLNEW TopFieldDocs (totalHits, fieldDocs, hqlen, hqFields);
-+ return pResult;
- }
-
- Query* MultiSearcher::rewrite(Query* query) {
-diff --git a/src/core/CLucene/util/_MD5Digester.h b/src/core/CLucene/util/_MD5Digester.h
-index aff913ac..e7060a24 100644
---- a/src/core/CLucene/util/_MD5Digester.h
-+++ b/src/core/CLucene/util/_MD5Digester.h
-@@ -102,7 +102,6 @@ private:
- uint32_t m_Count[2];
- uint8_t m_Buffer[64];
- uint8_t m_Digest[16];
-- uint8_t m_Finalized;
-
- };
-
-diff --git a/src/shared/CLucene/util/StringBuffer.cpp b/src/shared/CLucene/util/StringBuffer.cpp
-index 63c78bb2..57ffcba5 100644
---- a/src/shared/CLucene/util/StringBuffer.cpp
-+++ b/src/shared/CLucene/util/StringBuffer.cpp
-@@ -292,14 +292,15 @@ CL_NS_DEF(util)
-
- //Allocate a new buffer of length bufferLength
- TCHAR* tmp = _CL_NEWARRAY(TCHAR,bufferLength);
-- _tcsncpy(tmp, buffer, len);
-- tmp[len] = '\0';
-+ if (buffer){
-+ _tcsncpy(tmp, buffer, len);
-+ tmp[len] = '\0';
-
-- //destroy the old buffer
-- if (buffer){
-- _CLDELETE_CARRAY(buffer);
-- }
-- //Assign the new buffer tmp to buffer
-+ //destroy the old buffer
-+ _CLDELETE_CARRAY(buffer);
-+ }
-+
-+ //Assign the new buffer tmp to buffer
- buffer = tmp;
- }
-
-@@ -337,11 +338,13 @@ CL_NS_DEF(util)
- //The old buffer might not have been null-terminated, so we _tcsncpy
- //only len bytes, not len+1 bytes (the latter might read one char off the
- //end of the old buffer), then apply the terminator to the new buffer.
-- _tcsncpy(tmp + skippingNInitialChars, buffer, len);
-- tmp[skippingNInitialChars + len] = '\0';
-+ if (buffer) {
-+ _tcsncpy(tmp + skippingNInitialChars, buffer, len);
-+ tmp[skippingNInitialChars + len] = '\0';
-
-- //destroy the old buffer
-- _CLDELETE_LCARRAY(buffer);
-+ //destroy the old buffer
-+ _CLDELETE_LCARRAY(buffer);
-+ }
-
- //Assign the new buffer tmp to buffer
- buffer = tmp;
---
-2.37.1 (Apple Git-137.1)
-