summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/libs/poco/Foundation/src/TextIterator.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/contrib/libs/poco/Foundation/src/TextIterator.cpp b/contrib/libs/poco/Foundation/src/TextIterator.cpp
index e61bad37318..f82aa7821ff 100644
--- a/contrib/libs/poco/Foundation/src/TextIterator.cpp
+++ b/contrib/libs/poco/Foundation/src/TextIterator.cpp
@@ -108,12 +108,14 @@ int TextIterator::operator * () const
int read = 1;
int n = _pEncoding->queryConvert(buffer, 1);
- while (-1 > n && (_end - it) >= -n - read)
+ while (-1 > n && (_end - it) >= (-n - read) &&
+ TextEncoding::MAX_SEQUENCE_LENGTH > read)
{
- while (read < -n && it != _end)
- {
- *p++ = *it++;
- read++;
+ while (read < -n && it != _end &&
+ read < TextEncoding::MAX_SEQUENCE_LENGTH)
+ {
+ *p++ = *it++;
+ read++;
}
n = _pEncoding->queryConvert(buffer, read);
}
@@ -145,9 +147,11 @@ TextIterator& TextIterator::operator ++ ()
int read = 1;
int n = _pEncoding->sequenceLength(buffer, 1);
- while (-1 > n && (_end - _it) >= -n - read)
+ while (-1 > n && (_end - _it) >= (-n - read) &&
+ TextEncoding::MAX_SEQUENCE_LENGTH > read)
{
- while (read < -n && _it != _end)
+ while (read < -n && _it != _end &&
+ read < TextEncoding::MAX_SEQUENCE_LENGTH)
{
*p++ = *_it++;
read++;