aboutsummaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/swfinterp.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2014-11-17 04:36:23 +0100
committerPhilipp Hagemeister <[email protected]>2014-11-17 04:36:23 +0100
commit8d05f2c16a79e4127963d28bb41587105680e72c (patch)
tree99f8a85c7519aea575c351a71981e718967f0402 /youtube_dl/swfinterp.py
parenta4bb83956cf3aa4f569c30b4d144b4fb327c7b56 (diff)
downloadyoutube-dl-8d05f2c16a79e4127963d28bb41587105680e72c.tar.gz
youtube-dl-8d05f2c16a79e4127963d28bb41587105680e72c.zip
[swfinterp] Add support for void methods
Diffstat (limited to 'youtube_dl/swfinterp.py')
-rw-r--r--youtube_dl/swfinterp.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/youtube_dl/swfinterp.py b/youtube_dl/swfinterp.py
index dd4dd060a..f4ee022f4 100644
--- a/youtube_dl/swfinterp.py
+++ b/youtube_dl/swfinterp.py
@@ -504,6 +504,9 @@ class SWFInterpreter(object):
raise NotImplementedError(
'Unsupported property %r on %r'
% (mname, obj))
+ elif opcode == 71: # returnvoid
+ res = None
+ return res
elif opcode == 72: # returnvalue
res = stack.pop()
return res
@@ -527,6 +530,17 @@ class SWFInterpreter(object):
args = list(reversed(
[stack.pop() for _ in range(arg_count)]))
obj = stack.pop()
+ if isinstance(obj, _AVMClass_Object):
+ func = self.extract_function(obj.avm_class, mname)
+ res = func(args)
+ assert res is None
+ continue
+ if isinstance(obj, _ScopeDict):
+ assert mname in obj.avm_class.method_names
+ func = self.extract_function(obj.avm_class, mname)
+ res = func(args)
+ assert res is None
+ continue
if mname == 'reverse':
assert isinstance(obj, list)
obj.reverse()
@@ -603,7 +617,8 @@ class SWFInterpreter(object):
obj = stack.pop()
assert isinstance(obj, (dict, _ScopeDict)), \
'Accessing member %r on %r' % (pname, obj)
- stack.append(obj[pname])
+ res = obj.get(pname, None)
+ stack.append(res)
else: # Assume attribute access
idx = stack.pop()
assert isinstance(idx, int)