Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#257 closed defect (fixed)

upstream backup servers index out of bounds

Reported by: Thomas Chen Owned by: Valentin V. Bartenev
Priority: minor Milestone:
Component: nginx-module Version: 1.2.x
Keywords: Cc:
uname -a:
nginx -V: 1.2.6
1.3.9

Description

--- a/src/http/ngx_http_upstream_round_robin.c  2012-12-11 00:35:32.000000000 +0800
+++ b/src/http/ngx_http_upstream_round_robin.c  2012-12-13 14:41:45.050418212 +0800
@@ -474,7 +474,8 @@
         rrp->peers = peers->next;
         pc->tries = rrp->peers->number;
 
-        n = rrp->peers->number / (8 * sizeof(uintptr_t)) + 1;
+        n = (rrp->peers->number + (8 * sizeof(uintptr_t) - 1))
+                / (8 * sizeof(uintptr_t));
         for (i = 0; i < n; i++) {
              rrp->tried[i] = 0;
         }

Change History (5)

comment:1 by Valentin V. Bartenev, 12 years ago

Status: newaccepted

comment:2 by maxim, 12 years ago

Owner: set to Valentin V. Bartenev
Status: acceptedassigned

comment:3 by Valentin V. Bartenev, 12 years ago

In 4992/nginx:

Upstream: fixed state resetting when switching to backup servers.

Based on patch by Thomas Chen (ticket #257).

comment:4 by Valentin V. Bartenev, 12 years ago

Resolution: fixed
Status: assignedclosed

The fix was committed as part of r4992. Thank you.

comment:5 by Maxim Dounin, 12 years ago

In 5056/nginx:

Merge of r4992: off-by-one with 32/64 upstream backup servers.

Fixed off-by-one during upstream state resetting when switching to
backup servers if there were exactly 32 (64 on 64-bit platforms)
backup servers configured.

Based on patch by Thomas Chen (ticket #257).

Note: See TracTickets for help on using tickets.