summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAlexander Borisov <alexander.borisov@nginx.com>2018-02-06 21:13:57 +0300
committerAlexander Borisov <alexander.borisov@nginx.com>2018-02-06 21:13:57 +0300
commit79259d1ebd5b275b723ed2fcfb1f0a3921516c88 (patch)
tree0bb88b89406514e513f3f0a4fb4fc02653da1eea /src
parentb4e467e669fc35a92e371280e4068653db53c1b5 (diff)
downloadunit-79259d1ebd5b275b723ed2fcfb1f0a3921516c88.tar.gz
unit-79259d1ebd5b275b723ed2fcfb1f0a3921516c88.tar.bz2
Perl: added more checks for 'body' variable
Diffstat (limited to 'src')
-rw-r--r--src/perl/nxt_perl_psgi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/perl/nxt_perl_psgi.c b/src/perl/nxt_perl_psgi.c
index 21cd0b8a..d86976d6 100644
--- a/src/perl/nxt_perl_psgi.c
+++ b/src/perl/nxt_perl_psgi.c
@@ -896,6 +896,11 @@ nxt_perl_psgi_result_body_ref(PerlInterpreter *my_perl, SV *sv_body,
u_char vbuf[8192];
io = GvIO(SvRV(sv_body));
+
+ if (io == NULL) {
+ return NXT_OK;
+ }
+
fp = IoIFP(io);
for ( ;; ) {
@@ -1015,7 +1020,7 @@ nxt_perl_psgi_result_array(PerlInterpreter *my_perl, SV *result,
sv_temp = av_fetch(array, 2, 0);
- if (nxt_slow_path(sv_temp == NULL)) {
+ if (nxt_slow_path(sv_temp == NULL || SvROK(*sv_temp) == FALSE)) {
nxt_log_error(NXT_LOG_ERR, task->log,
"PSGI: Failed to get body from Perl ARRAY variable");