Browse Source

Fix find_node issue with hash collisions

It could happen that when several keys produces the same hash that
find_node was not trying hard enough to traverse the rb tree.
Thanks to Markus Doppelbauer for his detailed bug report and test case.

Signed-off-by: Brice Figureau <brice@daysofwonder.com>
tags/v0.8.1
Brice Figureau 16 years ago
parent
commit
c740674799
2 changed files with 7 additions and 1 deletions
  1. 6
    0
      CHANGES
  2. 1
    1
      ngx_http_uploadprogress_module.c

+ 6
- 0
CHANGES View File

1
+nginx_upload_progress release 0.8.1                              27 Feb 2010
2
+
3
+ * Fixed find_node so that it can find correctly nodes when there is an
4
+ hash collision (thanks to Markus Doppelbauer for his detailed bug report
5
+ and test case).
6
+ 
1
 nginx_upload_progress release 0.8                                  19 Dec 2009
7
 nginx_upload_progress release 0.8                                  19 Dec 2009
2
 
8
 
3
  * fixed segfault at start on some platforms (reported by Vladimir 
9
  * fixed segfault at start on some platforms (reported by Vladimir 

+ 1
- 1
ngx_http_uploadprogress_module.c View File

390
 
390
 
391
         } while (node != sentinel && hash == node->key);
391
         } while (node != sentinel && hash == node->key);
392
 
392
 
393
-        break;
393
+        /* found a key with unmatching hash (and value), let's keep comparing hashes then */
394
     }
394
     }
395
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "upload-progress: can't find node");
395
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "upload-progress: can't find node");
396
     return NULL;
396
     return NULL;

Loading…
Cancel
Save