mirror of https://github.com/nginx/nginx
Slice filter: improved memory allocation error handling.
As uncovered by recent addition in slice.t, a partially initialized context, coupled with HTTP 206 response from stub backend, might be accessed in the next slice subrequest. Found by bad memory allocator simulation.
This commit is contained in:
parent
d16251969b
commit
d313056537
|
|
@ -419,13 +419,13 @@ ngx_http_slice_range_variable(ngx_http_request_t *r,
|
|||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_http_set_ctx(r, ctx, ngx_http_slice_filter_module);
|
||||
|
||||
p = ngx_pnalloc(r->pool, sizeof("bytes=-") - 1 + 2 * NGX_OFF_T_LEN);
|
||||
if (p == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_http_set_ctx(r, ctx, ngx_http_slice_filter_module);
|
||||
|
||||
ctx->start = slcf->size * (ngx_http_slice_get_start(r) / slcf->size);
|
||||
|
||||
ctx->range.data = p;
|
||||
|
|
|
|||
Loading…
Reference in New Issue