forked from svaarala/duktape
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbytecodedumpload.html
More file actions
29 lines (25 loc) · 1.45 KB
/
bytecodedumpload.html
File metadata and controls
29 lines (25 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<h1 id="bytecodedumpload">Bytecode dump/load</h1>
<p>The API calls
<code><a href="api.html#duk_dump_function">duk_dump_function()</a></code> and
<code><a href="api.html#duk_load_function">duk_load_function()</a></code> allow
calling C code to (1) serialize an ECMAScript function into a portable
bytecode and then (2) load the bytecode to reconstitute the function.</p>
<p>The bytecode format is Duktape version specific and it's unsafe to
load bytecode from a different Duktape minor version (patch version
doesn't affect bytecode compatibility). Duktape configuration options
may also affect bytecode compatibility, so dump/load source and target
must be compiled with the same options. The bytecode format is platform
neutral so that you can compile bytecode on one platform and then load it
on another, which is useful for cross-platform builds. Duktape does not
validate loaded bytecode so calling code must ensure bytecode is intact
and valid for the running Duktape version.</p>
<div class="note">
Calling code must ensure that bytecode being loaded is intact and valid
for the running Duktape version (i.e. it has been compiled with the same
version of Duktape and hasn't been modified since). Loading invalid
bytecode may lead to memory unsafe behavior; loading maliciously crafted
bytecode may even lead to exploitable vulnerabilities.
</div>
<p>See
<a href="https://github.com/svaarala/duktape/blob/master/doc/bytecode.rst">bytecode.rst</a>
for more details.</p>