mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 916845: Use size_t to describe length of source code in SpiderMonkey SourceHook lazy source hook. r=jorendorff
This commit is contained in:
parent
1dc4fad878
commit
63811d0b30
@ -204,7 +204,7 @@ extern JS_FRIEND_API(bool)
|
||||
JS_DefineFunctionsWithHelp(JSContext *cx, JSObject *obj, const JSFunctionSpecWithHelp *fs);
|
||||
|
||||
typedef bool (* JS_SourceHook)(JSContext *cx, const char *filename,
|
||||
jschar **src, uint32_t *length);
|
||||
jschar **src, size_t *length);
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
JS_SetSourceHook(JSRuntime *rt, JS_SourceHook hook);
|
||||
|
@ -998,7 +998,7 @@ JSScript::loadSource(JSContext *cx, ScriptSource *ss, bool *worked)
|
||||
if (!cx->runtime()->sourceHook || !ss->sourceRetrievable())
|
||||
return true;
|
||||
jschar *src = NULL;
|
||||
uint32_t length;
|
||||
size_t length;
|
||||
if (!cx->runtime()->sourceHook(cx, ss->filename(), &src, &length))
|
||||
return false;
|
||||
if (!src)
|
||||
@ -1124,7 +1124,7 @@ ScriptSource::setSourceCopy(ExclusiveContext *cx, const jschar *src, uint32_t le
|
||||
}
|
||||
|
||||
void
|
||||
ScriptSource::setSource(const jschar *src, uint32_t length)
|
||||
ScriptSource::setSource(const jschar *src, size_t length)
|
||||
{
|
||||
JS_ASSERT(!hasSourceData());
|
||||
length_ = length;
|
||||
|
@ -341,7 +341,7 @@ class ScriptSource
|
||||
uint32_t length,
|
||||
bool argumentsNotIncluded,
|
||||
SourceCompressionTask *tok);
|
||||
void setSource(const jschar *src, uint32_t length);
|
||||
void setSource(const jschar *src, size_t length);
|
||||
bool ready() const { return ready_; }
|
||||
void setSourceRetrievable() { sourceRetrievable_ = true; }
|
||||
bool sourceRetrievable() const { return sourceRetrievable_; }
|
||||
|
@ -2774,7 +2774,7 @@ PreserveWrapper(JSContext *cx, JSObject *obj)
|
||||
}
|
||||
|
||||
static nsresult
|
||||
ReadSourceFromFilename(JSContext *cx, const char *filename, jschar **src, uint32_t *len)
|
||||
ReadSourceFromFilename(JSContext *cx, const char *filename, jschar **src, size_t *len)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -2812,6 +2812,10 @@ ReadSourceFromFilename(JSContext *cx, const char *filename, jschar **src, uint32
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!rawLen)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Technically, this should be SIZE_MAX, but we don't run on machines
|
||||
// where that would be less than UINT32_MAX, and the latter is already
|
||||
// well beyond a reasonable limit.
|
||||
if (rawLen > UINT32_MAX)
|
||||
return NS_ERROR_FILE_TOO_BIG;
|
||||
|
||||
@ -2849,7 +2853,7 @@ ReadSourceFromFilename(JSContext *cx, const char *filename, jschar **src, uint32
|
||||
function. See the comment in the XPCJSRuntime constructor.
|
||||
*/
|
||||
static bool
|
||||
SourceHook(JSContext *cx, const char *filename, jschar **src, uint32_t *length)
|
||||
SourceHook(JSContext *cx, const char *filename, jschar **src, size_t *length)
|
||||
{
|
||||
*src = NULL;
|
||||
*length = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user