[nginx] svn commit: r4859 - in branches/stable-1.2: . src/http/modules

mdounin at mdounin.ru mdounin at mdounin.ru
Mon Sep 24 19:11:46 UTC 2012


Author: mdounin
Date: 2012-09-24 19:11:45 +0000 (Mon, 24 Sep 2012)
New Revision: 4859
URL: http://trac.nginx.org/nginx/changeset/4859/nginx

Log:
Merge of r4833: limit req: fix of rbtree node insertion.

Limit req: fix of rbtree node insertion on hash collisions.

The rbtree used in ngx_http_limit_req_module has two level of keys, the top is
hash, and the next is the value string itself. However, when inserting a new
node, only hash has been set, while the value string has been left empty.

The bug was introduced in r4419 (1.1.14).
Found by Charles Chen.


Modified:
   branches/stable-1.2/
   branches/stable-1.2/src/http/modules/ngx_http_limit_req_module.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2012-09-24 19:06:48 UTC (rev 4858)
+++ branches/stable-1.2	2012-09-24 19:11:45 UTC (rev 4859)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4832,4834,4840,4842-4844
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4834,4840,4842-4844
\ No newline at end of property
Modified: branches/stable-1.2/src/http/modules/ngx_http_limit_req_module.c
===================================================================
--- branches/stable-1.2/src/http/modules/ngx_http_limit_req_module.c	2012-09-24 19:06:48 UTC (rev 4858)
+++ branches/stable-1.2/src/http/modules/ngx_http_limit_req_module.c	2012-09-24 19:11:45 UTC (rev 4859)
@@ -444,17 +444,17 @@
 
     node->key = hash;
 
-    ngx_rbtree_insert(&ctx->sh->rbtree, node);
-
     lr = (ngx_http_limit_req_node_t *) &node->color;
 
-    ngx_queue_insert_head(&ctx->sh->queue, &lr->queue);
-
     lr->len = (u_char) len;
     lr->excess = 0;
 
     ngx_memcpy(lr->data, data, len);
 
+    ngx_rbtree_insert(&ctx->sh->rbtree, node);
+
+    ngx_queue_insert_head(&ctx->sh->queue, &lr->queue);
+
     if (account) {
         lr->last = now;
         lr->count = 0;



More information about the nginx-devel mailing list