From: Dmitry Volyntsev Date: Sat, 27 Apr 2019 17:28:37 +0000 (+0300) Subject: Fixed null pointer dereferences introduced in f5bdddca3252. X-Git-Tag: 0.3.2~38 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=c0d503d9f2e4c416f3b98c9eeac2157132a34572;p=njs.git Fixed null pointer dereferences introduced in f5bdddca3252. CID 1444775, CID 1444776. --- diff --git a/njs/njs_array.c b/njs/njs_array.c index 934f6256..3394dcba 100644 --- a/njs/njs_array.c +++ b/njs/njs_array.c @@ -432,6 +432,11 @@ njs_array_length(njs_vm_t *vm, njs_value_t *value, njs_value_t *setval, proto = proto->__proto__; } while (proto != NULL); + if (nxt_slow_path(proto == NULL)) { + njs_internal_error(vm, "no array in proto chain"); + return NJS_ERROR; + } + array = (njs_array_t *) proto; if (setval != NULL) { diff --git a/njs/njs_function.c b/njs/njs_function.c index c60e3249..f1743cd2 100644 --- a/njs/njs_function.c +++ b/njs/njs_function.c @@ -921,6 +921,11 @@ njs_function_instance_length(njs_vm_t *vm, njs_value_t *value, proto = proto->__proto__; } while (proto != NULL); + if (nxt_slow_path(proto == NULL)) { + njs_internal_error(vm, "no function in proto chain"); + return NJS_ERROR; + } + function = (njs_function_t *) proto; if (function->native) {