Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
a9bc71c0
Commit
a9bc71c0
authored
Jul 08, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strings: skip XML-invalid non-printable characters (fixes #15027)
parent
66315042
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
src/test/xmlent.c
src/test/xmlent.c
+2
-2
src/text/strings.c
src/text/strings.c
+16
-5
No files found.
src/test/xmlent.c
View file @
a9bc71c0
...
@@ -82,8 +82,8 @@ int main (void)
...
@@ -82,8 +82,8 @@ int main (void)
encode
(
""
,
""
);
encode
(
""
,
""
);
encode
(
"a'àc
\"
çe&én<ño>ö1:"
,
"a'àc"çe&én<ño>ö1:"
);
encode
(
"a'àc
\"
çe&én<ño>ö1:"
,
"a'àc"çe&én<ño>ö1:"
);
encode
(
"
\x
01\xC2\x81\xC2\x85
"
,
"

\xC2\x85
"
);
encode
(
"
\x
C2\x81\xC2\x85
"
,
"

\xC2\x85
"
);
encode
(
"
\r\n
"
,
"
\r\n
"
);
encode
(
"
\t\r\n
"
,
"
\t
\r\n
"
);
return
0
;
return
0
;
}
}
src/text/strings.c
View file @
a9bc71c0
...
@@ -312,10 +312,6 @@ char *convert_xml_special_chars (const char *str)
...
@@ -312,10 +312,6 @@ char *convert_xml_special_chars (const char *str)
return
NULL
;
return
NULL
;
}
}
if
((
cp
&
~
0x0080
)
<
32
/* C0/C1 control codes */
&&
memchr
(
"
\x09\x0A\x0D\x85
"
,
cp
,
4
)
==
NULL
)
ptr
+=
sprintf
(
ptr
,
"&#%"
PRIu32
";"
,
cp
);
else
switch
(
cp
)
switch
(
cp
)
{
{
case
'\"'
:
strcpy
(
ptr
,
"""
);
ptr
+=
6
;
break
;
case
'\"'
:
strcpy
(
ptr
,
"""
);
ptr
+=
6
;
break
;
...
@@ -323,7 +319,22 @@ char *convert_xml_special_chars (const char *str)
...
@@ -323,7 +319,22 @@ char *convert_xml_special_chars (const char *str)
case
'\''
:
strcpy
(
ptr
,
"'"
);
ptr
+=
5
;
break
;
case
'\''
:
strcpy
(
ptr
,
"'"
);
ptr
+=
5
;
break
;
case
'<'
:
strcpy
(
ptr
,
"<"
);
ptr
+=
4
;
break
;
case
'<'
:
strcpy
(
ptr
,
"<"
);
ptr
+=
4
;
break
;
case
'>'
:
strcpy
(
ptr
,
">"
);
ptr
+=
4
;
break
;
case
'>'
:
strcpy
(
ptr
,
">"
);
ptr
+=
4
;
break
;
default:
memcpy
(
ptr
,
str
,
n
);
ptr
+=
n
;
break
;
default:
if
(
cp
<
32
)
/* C0 code not allowed (except 9, 10 and 13) */
break
;
if
(
cp
>=
128
&&
cp
<
160
)
/* C1 code encoded (except 133) */
{
ptr
+=
sprintf
(
ptr
,
"&#%"
PRIu32
";"
,
cp
);
break
;
}
/* fall through */
case
9
:
case
10
:
case
13
:
case
133
:
memcpy
(
ptr
,
str
,
n
);
ptr
+=
n
;
break
;
}
}
str
+=
n
;
str
+=
n
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment