Mercurial > hg > nginx-vendor-current
comparison src/http/modules/ngx_http_image_filter_module.c @ 526:0161f3197817 NGINX_0_8_15
nginx 0.8.15
*) Security: a segmentation fault might occur in worker process while
specially crafted request handling.
Thanks to Chris Ries.
*) Bugfix: if names .domain.tld, .sub.domain.tld, and .domain-some.tld
were defined, then the name .sub.domain.tld was matched by
.domain.tld.
*) Bugfix: in transparency support in the ngx_http_image_filter_module.
*) Bugfix: in file AIO.
*) Bugfix: in X-Accel-Redirect usage; the bug had appeared in 0.8.11.
*) Bugfix: in embedded perl module; the bug had appeared in 0.8.11.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 14 Sep 2009 00:00:00 +0400 |
parents | 24b676623d4f |
children | 005a70f9573b |
comparison
equal
deleted
inserted
replaced
525:1b64f9884263 | 526:0161f3197817 |
---|---|
677 | 677 |
678 static ngx_buf_t * | 678 static ngx_buf_t * |
679 ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx) | 679 ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx) |
680 { | 680 { |
681 int sx, sy, dx, dy, ox, oy, | 681 int sx, sy, dx, dy, ox, oy, |
682 colors, transparent, size; | 682 colors, transparent, red, green, blue, size; |
683 u_char *out; | 683 u_char *out; |
684 ngx_buf_t *b; | 684 ngx_buf_t *b; |
685 ngx_uint_t resize; | 685 ngx_uint_t resize; |
686 gdImagePtr src, dst; | 686 gdImagePtr src, dst; |
687 ngx_pool_cleanup_t *cln; | 687 ngx_pool_cleanup_t *cln; |
705 return ngx_http_image_asis(r, ctx); | 705 return ngx_http_image_asis(r, ctx); |
706 } | 706 } |
707 | 707 |
708 colors = gdImageColorsTotal(src); | 708 colors = gdImageColorsTotal(src); |
709 transparent = gdImageGetTransparent(src); | 709 transparent = gdImageGetTransparent(src); |
710 | |
711 if (transparent != -1 && colors) { | |
712 red = gdImageRed(src, transparent); | |
713 green = gdImageGreen(src, transparent); | |
714 blue = gdImageBlue(src, transparent); | |
715 gdImageColorTransparent(src, -1); | |
716 | |
717 } else { | |
718 red = 0; green = 0; blue = 0; | |
719 } | |
710 | 720 |
711 dx = sx; | 721 dx = sx; |
712 dy = sy; | 722 dy = sy; |
713 | 723 |
714 if (conf->filter == NGX_HTTP_IMAGE_RESIZE) { | 724 if (conf->filter == NGX_HTTP_IMAGE_RESIZE) { |
804 | 814 |
805 gdImageDestroy(src); | 815 gdImageDestroy(src); |
806 } | 816 } |
807 } | 817 } |
808 | 818 |
809 gdImageColorTransparent(dst, transparent); | 819 if (transparent != -1 && colors) { |
820 gdImageColorTransparent(dst, gdImageColorExact(dst, red, green, blue)); | |
821 } | |
810 | 822 |
811 out = ngx_http_image_out(r, ctx->type, dst, &size); | 823 out = ngx_http_image_out(r, ctx->type, dst, &size); |
812 | 824 |
813 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 825 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
814 "image: %d x %d %d", sx, sy, colors); | 826 "image: %d x %d %d", sx, sy, colors); |