From: Lars Knoll Date: Tue, 16 Apr 2013 07:05:47 +0000 (+0200) Subject: Fix two more corner cases in the v8 API X-Git-Tag: upstream/5.2.1~669^2~652 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c5d88994c57c50fc8ffe4cd5d2b8d5d0b7c8084;p=platform%2Fupstream%2Fqtdeclarative.git Fix two more corner cases in the v8 API if Script::Run() catches an exception return an empty Handle. Don't try to set the array length to negative numbers. Change-Id: Icefa3bc66d0359c0d3cffcf7c6650c8db34cc9aa Reviewed-by: Simon Hausmann --- diff --git a/src/qml/qml/v4vm/qv4v8.cpp b/src/qml/qml/v4vm/qv4v8.cpp index cc1ff1c..fe0130e 100644 --- a/src/qml/qml/v4vm/qv4v8.cpp +++ b/src/qml/qml/v4vm/qv4v8.cpp @@ -254,6 +254,7 @@ Local Script::Run() } catch (VM::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(ctx); + return Local(); } return Local::New(Value::fromVmValue(result)); @@ -1087,6 +1088,8 @@ uint32_t Array::Length() const Local Array::New(int length) { + if (length < 0) + length = 0; VM::ArrayObject *a = currentEngine()->newArrayObject(currentEngine()->current); if (length < 0x1000) a->arrayReserve(length);