Skip to content
This repository
Browse code

Fix issue where parsing XML character entries are ignored. Fixes issu…

…e #12999.
  • Loading branch information...
commit 565c88f1e7126e1819d9caac55a346c5e6b3dbe0 1 parent 3d8a9ec
Andres Mejia amejia1 authored

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. +3 3 xbmc/utils/XBMCTinyXML.cpp
6 xbmc/utils/XBMCTinyXML.cpp
@@ -21,7 +21,7 @@
21 21 #include "filesystem/File.h"
22 22 #include "RegExp.h"
23 23
24   -#define MAX_ENTITY_LENGTH 6 // size of largest entity "'"
  24 +#define MAX_ENTITY_LENGTH 8 // size of largest entity "&#xNNNN;"
25 25 #define BUFFER_SIZE 4096
26 26
27 27 CXBMCTinyXML::CXBMCTinyXML()
@@ -130,7 +130,7 @@ const char *CXBMCTinyXML::Parse(CStdString &data, TiXmlParsingData *prevData, Ti
130 130 // Preprocess string, replacing '&' with '& for invalid XML entities
131 131 size_t pos = 0;
132 132 CRegExp re(true);
133   - re.RegComp("^&(amp|lt|gt|quot|apos);.*");
  133 + re.RegComp("^&(amp|lt|gt|quot|apos|#x[a-fA-F0-9]{1,4});.*");
134 134 while ((pos = data.find("&", pos)) != CStdString::npos)
135 135 {
136 136 CStdString tmp = data.substr(pos, pos + MAX_ENTITY_LENGTH);
@@ -149,7 +149,7 @@ bool CXBMCTinyXML::Test()
149 149 "cache=\"tmdb-en-12244.json\">"
150 150 "http://api.themoviedb.org/3/movie/12244"
151 151 "?api_key=57983e31fb435df4df77afb854740ea9"
152   - "&language=en</url></details>");
  152 + "&language=en&#01af;&#x01AF;</url></details>");
153 153 doc.Parse(data.c_str());
154 154 TiXmlNode *root = doc.RootElement();
155 155 if (root && root->ValueStr() == "details")

1 comment on commit 565c88f

Voyager1
Collaborator

it seems that this ticket (http://trac.xbmc.org/ticket/13059) reveals that there's still a problem in case the xml code is decimal instead of hexadecimal.

Please sign in to comment.
Something went wrong with that request. Please try again.