projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5eb778b
)
compat_urllib_parse_unquote: crash fix: only decode valid hex
author
fnord
<fnord@fnord.mobi>
Wed, 15 Jul 2015 20:13:56 +0000
(15:13 -0500)
committer
fnord
<fnord@fnord.mobi>
Wed, 15 Jul 2015 20:28:50 +0000
(15:28 -0500)
on python 2 the following has a { "crash_rate": "100%" } of the time
as it tries to parse '" ' as hex.
youtube_dl/compat.py
patch
|
blob
|
history
diff --git
a/youtube_dl/compat.py
b/youtube_dl/compat.py
index c3783337a5a801cd5230f2ae2f5d82112d4b6cea..1f4ccf443214d322121938cca58150f9aaa8803f 100644
(file)
--- 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: