The following issues were found
libs/qscintilla/lexlib/SparseState.h
1 issues
Line: 85
Column: 22
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
typename stateVector::iterator low = Find(other.positionFirst);
if (static_cast<size_t>(states.end() - low) == other.states.size()) {
// Same number in other as after positionFirst in this
different = !std::equal(low, states.end(), other.states.begin());
}
if (different) {
if (low != states.end()) {
states.erase(low, states.end());
changed = true;
Reported by FlawFinder.
libs/qscintilla/src/CallTip.cpp
1 issues
Line: 192
Column: 26
CWE codes:
126
while (moreChunks) {
const char *chunkEnd = strchr(chunkVal, '\n');
if (!chunkEnd) {
chunkEnd = chunkVal + strlen(chunkVal);
moreChunks = false;
}
const int chunkOffset = static_cast<int>(chunkVal - val.c_str());
const int chunkLength = static_cast<int>(chunkEnd - chunkVal);
const int chunkEndOffset = chunkOffset + chunkLength;
Reported by FlawFinder.
libs/qscintilla/lexers/LexJSON.cpp
1 issues
Line: 187
Column: 3
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static bool IsNextWordInList(WordList &keywordList, CharacterSet wordSet,
StyleContext &context, LexAccessor &styler) {
char word[51];
Sci_Position currPos = (Sci_Position) context.currentPos;
int i = 0;
while (i < 50) {
char ch = styler.SafeGetCharAt(currPos + i);
if (!wordSet.Contains(ch)) {
Reported by FlawFinder.
libs/qscintilla/src/CaseFolder.h
1 issues
Line: 21
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
class CaseFolderTable : public CaseFolder {
protected:
char mapping[256];
public:
CaseFolderTable();
~CaseFolderTable() override;
size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override;
void SetTranslation(char ch, char chTranslation);
Reported by FlawFinder.
libs/qscintilla/src/CharClassify.h
1 issues
Line: 26
Column: 11
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
private:
enum { maxChar=256 };
unsigned char charClass[maxChar]; // not type cc to save space
};
}
#endif
Reported by FlawFinder.
libs/qscintilla/src/ExternalLexer.cpp
1 issues
Line: 65
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
for (int i = 0; i < nl; i++) {
// Assign a buffer for the lexer name.
char lexname[100] = "";
GetLexerName(i, lexname, sizeof(lexname));
ExternalLexerModule *lex = new ExternalLexerModule(SCLEX_AUTOMATIC, nullptr, lexname, nullptr);
// This is storing a second reference to lex in the Catalogue as well as in modules.
// TODO: Should use std::shared_ptr or similar to ensure allocation safety.
Catalogue::AddLexerModule(lex);
Reported by FlawFinder.
libs/qscintilla/src/LineMarker.cpp
1 issues
Line: 380
Column: 3
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
DrawMinus(surface, centreX, centreY, blobSize, colourTail);
} else if (markType >= SC_MARK_CHARACTER) {
char character[1];
character[0] = static_cast<char>(markType - SC_MARK_CHARACTER);
const XYPOSITION width = surface->WidthText(fontForCharacter, character, 1);
PRectangle rcText = rc;
rcText.left += (rc.Width() - width) / 2;
rcText.right = rc.left + width;
Reported by FlawFinder.
libs/qscintilla/src/PositionCache.h
1 issues
Line: 71
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
std::unique_ptr<char[]> chars;
std::unique_ptr<unsigned char[]> styles;
std::unique_ptr<XYPOSITION[]> positions;
char bracePreviousStyles[2];
// Hotspot support
Range hotspot;
// Wrapped line support
Reported by FlawFinder.
libs/qscintilla/src/UniConversion.cpp
1 issues
Line: 229
Column: 16
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
}
const unsigned char UTF8BytesOfLead[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 00 - 0F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 10 - 1F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 20 - 2F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 30 - 3F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 40 - 4F
Reported by FlawFinder.
libs/qscintilla/src/UniConversion.h
1 issues
Line: 27
Column: 23
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
bool UTF8IsValid(const char *s, size_t len) noexcept;
std::string FixInvalidUTF8(const std::string &text);
extern const unsigned char UTF8BytesOfLead[256];
inline int UnicodeFromUTF8(const unsigned char *us) noexcept {
switch (UTF8BytesOfLead[us[0]]) {
case 1:
return us[0];
Reported by FlawFinder.