aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Gottardo <gottardo.stefano.83@gmail.com>2024-10-08 15:49:38 +0200
committerGitHub <noreply@github.com>2024-10-08 15:49:38 +0200
commit90942fa1da3c16cb8c037f7ecfa9c150e98bd03d (patch)
tree7ec1d637331535d7813cc9f2829767317b77dca8
parentd59dbc43e488dbea13a1ac88138462ff3194dace (diff)
parenta401c31390d8f008807502ccc4021d05f7967609 (diff)
Merge pull request #25323 from CastagnaIT/subs_carriagereturn
[CharArrayParser] Skip malformed EOL
-rw-r--r--xbmc/utils/CharArrayParser.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/xbmc/utils/CharArrayParser.cpp b/xbmc/utils/CharArrayParser.cpp
index 5aeec2040b..ec5af70a9c 100644
--- a/xbmc/utils/CharArrayParser.cpp
+++ b/xbmc/utils/CharArrayParser.cpp
@@ -156,11 +156,19 @@ bool CCharArrayParser::ReadNextLine(std::string& line)
line.assign(m_data + m_position, lineLimit - m_position);
m_position = lineLimit;
+ // Skip EOL chars
if (m_data[m_position] == '\r')
{
m_position++;
+
+ if (m_data[m_position] == '\n')
+ m_position++;
+ // Malformed EOL as \r\r\n
+ else if (m_position + 1 <= m_limit && m_data[m_position] == '\r' &&
+ m_data[m_position + 1] == '\n')
+ m_position += 2;
}
- if (m_data[m_position] == '\n')
+ else if (m_data[m_position] == '\n')
{
m_position++;
}