]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[swfinterp] Intepret more multinames
authorPhilipp Hagemeister <phihag@phihag.de>
Mon, 17 Nov 2014 02:46:23 +0000 (03:46 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Mon, 17 Nov 2014 02:46:23 +0000 (03:46 +0100)
test/swftests/DictCall.as [new file with mode: 0644]
youtube_dl/swfinterp.py

diff --git a/test/swftests/DictCall.as b/test/swftests/DictCall.as
new file mode 100644 (file)
index 0000000..236efd8
--- /dev/null
@@ -0,0 +1,10 @@
+// input: [{"x": 1, "y": 2}]
+// output: 3
+
+package {
+public class DictCall {
+    public static function main(d:Object):int{
+       return d.x + d.y;
+    }
+}
+}
index e5deb2c14df30c259b742ac73c2a765d94b56207..7c0ee1e61a89d13d56bf0f2c54111bd738054890 100644 (file)
@@ -213,6 +213,10 @@ class SWFInterpreter(object):
                 u30()  # namespace_idx
                 name_idx = u30()
                 self.multinames.append(self.constant_strings[name_idx])
+            elif kind == 0x09:
+                name_idx = u30()
+                u30()
+                self.multinames.append(self.constant_strings[name_idx])
             else:
                 self.multinames.append(_Multiname(kind))
                 for _c2 in range(MULTINAME_SIZES[kind]):
@@ -557,6 +561,11 @@ class SWFInterpreter(object):
                         obj = stack.pop()
                         assert isinstance(obj, list)
                         stack.append(len(obj))
+                    elif isinstance(pname, compat_str):  # Member access
+                        obj = stack.pop()
+                        assert isinstance(obj, (dict, _ScopeDict)), \
+                            'Accessing member on %r' % obj
+                        stack.append(obj[pname])
                     else:  # Assume attribute access
                         idx = stack.pop()
                         assert isinstance(idx, int)