Add error check to VM_OC_CLASS_INHERITANCE (#3122)

ecma_op_object_get_by_magic_id can throw an exception

Fixes #3121

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
This commit is contained in:
Daniel Balla 2019-09-16 12:32:56 +03:00 committed by Zoltan Herczeg
parent 83c44d20b3
commit 87441635e1
2 changed files with 24 additions and 0 deletions

View File

@ -1405,6 +1405,13 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
{
ecma_value_t super_prototype_value = ecma_op_object_get_by_magic_id (super_class_p,
LIT_MAGIC_STRING_PROTOTYPE);
if (ECMA_IS_VALUE_ERROR (super_prototype_value))
{
result = super_prototype_value;
goto error;
}
if (ecma_get_object_type (super_class_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION
&& !ecma_is_value_object (super_prototype_value))
{

View File

@ -0,0 +1,17 @@
// Copyright JS Foundation and other contributors, http://js.foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
var Base = function ( ) { }.bind( );
Object.defineProperty ( Base , 'prototype' , { get : function ( ) {$} } );
class C extends Base { }