mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Check for JS_ReportAllocationOverflow before using it.
Debian libmozjs-dev 1.9.0.4-2 has JS_ReportAllocationOverflow but js-1.7.0 reportedly hasn't. Check at configure time whether that function is available. If not, use JS_ReportOutOfMemory instead. Reported by Witold Filipczyk.
This commit is contained in:
parent
7941c7097a
commit
7067fc7af9
@ -629,6 +629,9 @@ fi
|
||||
|
||||
AC_MSG_RESULT($cf_result)
|
||||
CONFIG_SPIDERMONKEY="$cf_result"
|
||||
if test "$cf_result" = "yes"; then
|
||||
AC_CHECK_FUNCS([[JS_ReportAllocationOverflow]])
|
||||
fi
|
||||
EL_RESTORE_FLAGS
|
||||
|
||||
if test "x$CONFIG_SPIDERMONKEY" = xyes &&
|
||||
|
@ -195,7 +195,11 @@ utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length)
|
||||
* Check whether the multiplication could overflow. */
|
||||
assert(!needs_utf16_surrogates(UCS_REPLACEMENT_CHARACTER));
|
||||
if (in_bytes > ((size_t) -1) / sizeof(jschar)) {
|
||||
#ifdef HAVE_JS_REPORTALLOCATIONOVERFLOW
|
||||
JS_ReportAllocationOverflow(ctx);
|
||||
#else
|
||||
JS_ReportOutOfMemory(ctx);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
utf16_alloc = in_bytes;
|
||||
|
Loading…
Reference in New Issue
Block a user