Fix for null pointer dereference in jmem_heap_free_block (#2440)

Fixes #2435.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
This commit is contained in:
Daniel Balla
2018-08-01 16:09:30 +02:00
committed by yichoi
parent 1f20bb3fe5
commit 87897849f6
2 changed files with 20 additions and 1 deletions
@@ -553,6 +553,11 @@ ecma_builtin_typedarray_prototype_filter (ecma_value_t this_arg, /**< this argum
ecma_object_t *func_object_p = ecma_get_object_from_value (cb_func_val);
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
if (len == 0)
{
return ecma_op_create_typedarray_with_type_and_length (obj_p, 0);
}
JMEM_DEFINE_LOCAL_ARRAY (pass_value_list_p, len * element_size, lit_utf8_byte_t);
lit_utf8_byte_t *pass_value_p = pass_value_list_p;
@@ -588,7 +593,6 @@ ecma_builtin_typedarray_prototype_filter (ecma_value_t this_arg, /**< this argum
ret_value = ecma_op_create_typedarray_with_type_and_length (obj_p, pass_num);
if (!ECMA_IS_VALUE_ERROR (ret_value))
{
obj_p = ecma_get_object_from_value (ret_value);
@@ -0,0 +1,15 @@
// 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.
(new Int8Array(0)).filter(parseInt)