소스 검색

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 년 전
부모
커밋
c740674799
2개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 6
    0
      CHANGES
  2. 1
    1
      ngx_http_uploadprogress_module.c

+ 6
- 0
CHANGES 파일 보기

@@ -1,3 +1,9 @@
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 7
 nginx_upload_progress release 0.8                                  19 Dec 2009
2 8
 
3 9
  * fixed segfault at start on some platforms (reported by Vladimir 

+ 1
- 1
ngx_http_uploadprogress_module.c 파일 보기

@@ -390,7 +390,7 @@ find_node(ngx_str_t * id, ngx_http_uploadprogress_ctx_t * ctx, ngx_log_t * log)
390 390
 
391 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 395
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "upload-progress: can't find node");
396 396
     return NULL;

Loading…
취소
저장