summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-05-12 12:05:29 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-05-12 12:05:29 +0000
commitfd61ab45501a73188ac99018d7fbb102d66111fd (patch)
treeecc4c3c72621fb7a73e884681454ca69c2b49035
parent40d6ee9adea071f1c3e720f4f7076b829c2267dd (diff)
downloadnginx-fd61ab45501a73188ac99018d7fbb102d66111fd.tar.gz
test finalized image filter context before testing image_filter off
this fixes SIGFPE if image filter errors are passed to named location
-rw-r--r--src/http/modules/ngx_http_image_filter_module.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/http/modules/ngx_http_image_filter_module.c b/src/http/modules/ngx_http_image_filter_module.c
index 83fc1459e..fd20550d4 100644
--- a/src/http/modules/ngx_http_image_filter_module.c
+++ b/src/http/modules/ngx_http_image_filter_module.c
@@ -162,6 +162,13 @@ ngx_http_image_header_filter(ngx_http_request_t *r)
return ngx_http_next_header_filter(r);
}
+ ctx = ngx_http_get_module_ctx(r, ngx_http_image_filter_module);
+
+ if (ctx) {
+ ngx_http_set_ctx(r, NULL, ngx_http_image_filter_module);
+ return ngx_http_next_header_filter(r);
+ }
+
conf = ngx_http_get_module_loc_conf(r, ngx_http_image_filter_module);
if (conf->filter == NGX_HTTP_IMAGE_OFF) {
@@ -181,13 +188,6 @@ ngx_http_image_header_filter(ngx_http_request_t *r)
return NGX_ERROR;
}
- ctx = ngx_http_get_module_ctx(r, ngx_http_image_filter_module);
-
- if (ctx) {
- ngx_http_set_ctx(r, NULL, ngx_http_image_filter_module);
- return ngx_http_next_header_filter(r);
- }
-
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_image_filter_ctx_t));
if (ctx == NULL) {
return NGX_ERROR;