The tracedata contains function references to functions in the current
call stack. If these functions are not accessible from a sandboxed
environment (through the global object), sandboxed code may gain access
to functions it's not intended to have access to.
Before this fix, both DUK_F_GCC and DUK_F_CLANG would be defined when
compiling with clang. This might have had an impact on the #ifdef
ladders in duk_features.h.in so that this change may have some side
effects for clang.
Tzoffset calculations would be skipped if a temporary time value was just
outside the Ecmascript range. This can happen in some legitimate cases,
so a +/- 24h leeway was added to the check. This fixes a few test262
cases documented in test-bug-date-timeval-edges.js.
Similarly, add a +/- 24h leeway for an assert in local-time-to-parts
conversion. When converting a time value to parts and the parts are
requested in local time, a temporary time value (simulating local time) can
be just outside the Ecmascript range. Allow +/- 24h leeway in the assert
to avoid triggering it in valid edge cases.
See test-bug-date-timeval-edges.js for demonstration of both issues.
Without compact flag, valstack resize helper would always add more spare,
which would accumulate. This luckily broke test-bi-array-proto-join.js.
The commit also removes one helper layer from valstack resizing.
Avoid doing tzoffset computations when timevalue is outside Ecmascript
range. If we don't, some integer overflows happen and some internal
asserts will fail. This fixes test-bug-date-insane-setyear.js.
Avoid integer overflow in duk__make_day() when year is outside valid
Ecmascript range. Return NaN directly instead. This fixes
test-bug-date-setyear-overflow.js.
Must create a new scope instead of just setting _target of the existing one:
if just _target is set, it will affect other threads which share the same
(initial) built-ins. Instead, we must create a new scope object and replace
it entirely.
Add value stack asserts to executor for the (somewhat messy) resetting of
value stack top in a few longjmp handling cases.
Downgrade a few other FIXMEs. Ditz issues and XXX comments track whatever
improvements are left.
Note: If 'count' exceeds valstack_max, an "invalid count" message is thrown
(same goes for a negative count). Use the same message also for the case
where 'count' exceeds the source stack depth just a little. Previously the
code would use a different error message for this case.
This feature needs some more thought and has somewhat minimal performance
impact at present (10-15%) over the longjmp path. The better approach may
be to handle every return as a "fast return" and fall back to a longjmp in
special cases like thread yields and such.