aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/compat.py
diff options
context:
space:
mode:
authorfnord <fnord@fnord.mobi>2015-07-15 15:13:56 -0500
committerfnord <fnord@fnord.mobi>2015-07-15 15:28:50 -0500
commite37c932fca29d93af77b7a47cccc9bb8578e3163 (patch)
treefbee18a2b4856e886f0d989cd70878eae5186cd1 /youtube_dl/compat.py
parent5eb778bf4d52c2d1b53182e48c630a3458f2fb22 (diff)
compat_urllib_parse_unquote: crash fix: only decode valid hex
on python 2 the following has a { "crash_rate": "100%" } of the time as it tries to parse '" ' as hex.
Diffstat (limited to 'youtube_dl/compat.py')
-rw-r--r--youtube_dl/compat.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py
index c3783337a..1f4ccf443 100644
--- a/youtube_dl/compat.py
+++ b/youtube_dl/compat.py
@@ -94,6 +94,8 @@ except ImportError:
try:
if not item:
raise ValueError
+ if not re.match('[0-9a-fA-F][0-9a-fA-F]',item[:2]):
+ raise ValueError
pct_sequence += item[:2].decode('hex')
rest = item[2:]
if not rest: