Skip to content

Commit ffd6beb

Browse files
committed
Fixing out of bounds bugs.
1 parent 216e66f commit ffd6beb

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/mcommon/string/stringutils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,12 @@ std::string string_slurp_if(std::string::const_iterator& itr, std::string::const
338338
auto itrCurrent = itr;
339339
if (*itrCurrent == first)
340340
{
341-
while ((itrCurrent != itrEnd) && *itrCurrent != last)
341+
while ((itrCurrent < itrEnd) && *itrCurrent != last)
342342
{
343343
itrCurrent++;
344344
}
345345

346-
if ((itrCurrent != itrEnd) && *itrCurrent == last)
346+
if ((itrCurrent < itrEnd) && *itrCurrent == last)
347347
{
348348
itrCurrent++;
349349
auto ret = std::string(itr, itrCurrent);
@@ -362,7 +362,7 @@ std::string string_slurp_if(std::string::const_iterator& itr, std::string::const
362362
}
363363

364364
auto itrCurrent = itr;
365-
while ((itrCurrent != itrEnd) && fnIs(*itrCurrent))
365+
while ((itrCurrent < itrEnd) && fnIs(*itrCurrent))
366366
{
367367
itrCurrent++;
368368
}

src/syntax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ void ZepSyntax::UpdateSyntax()
192192
m_processedChar = long(itrCurrent - buffer.begin());
193193

194194
// Walk the buffer updating information about syntax coloring
195-
while (itrCurrent != itrEnd)
195+
while (itrCurrent < itrEnd)
196196
{
197197
if (m_stop == true)
198198
{

src/syntax_markdown.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void ZepSyntax_Markdown::UpdateSyntax()
4343
bool lineBegin = true;
4444

4545
// Walk backwards to previous delimiter
46-
while (itrCurrent != itrEnd)
46+
while (itrCurrent < itrEnd)
4747
{
4848
if (m_stop == true)
4949
{
@@ -57,7 +57,7 @@ void ZepSyntax_Markdown::UpdateSyntax()
5757
{
5858
lineBegin = false;
5959
auto itrStart = itrCurrent;
60-
while (itrCurrent != itrEnd &&
60+
while (itrCurrent < itrEnd &&
6161
*itrCurrent != '\n' &&
6262
*itrCurrent != 0)
6363
{
@@ -72,7 +72,7 @@ void ZepSyntax_Markdown::UpdateSyntax()
7272
{
7373
int inCount = 0;
7474
auto itrStart = itrCurrent;
75-
while (itrCurrent != itrEnd &&
75+
while (itrCurrent < itrEnd &&
7676
*itrCurrent != '\n' &&
7777
*itrCurrent != 0)
7878
{

src/syntax_tree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void ZepSyntax_Tree::UpdateSyntax()
4141
};
4242

4343
// Walk backwards to previous delimiter
44-
while (itrCurrent != itrEnd)
44+
while (itrCurrent < itrEnd)
4545
{
4646
if (m_stop == true)
4747
{

0 commit comments

Comments
 (0)