[Groonga-commit] groonga/groonga at 334d47a [master] ii: avoid underflow

Zurück zum Archiv-Index

Kouhei Sutou null+****@clear*****
Mon Apr 4 14:38:10 JST 2016


Kouhei Sutou	2016-04-04 14:38:10 +0900 (Mon, 04 Apr 2016)

  New Revision: 334d47a6b6f1b43ff8f84580ae99b16e4af864de
  https://github.com/groonga/groonga/commit/334d47a6b6f1b43ff8f84580ae99b16e4af864de

  Message:
    ii: avoid underflow

  Modified files:
    lib/ii.c

  Modified: lib/ii.c (+6 -1)
===================================================================
--- lib/ii.c    2016-04-04 14:36:29 +0900 (7bcac66)
+++ lib/ii.c    2016-04-04 14:38:10 +0900 (4e3f55a)
@@ -4378,7 +4378,12 @@ grn_ii_cursor_set_min(grn_ctx *ctx, grn_ii_cursor *c, grn_id min)
       uint32_t skip_chunk = 0;
       grn_id rid = c->prev_chunk_rid;
 
-      for (i = c->curr_chunk - 1; i < c->nchunks; i++) {
+      if (c->curr_chunk > 0) {
+        i = c->curr_chunk - 1;
+      } else {
+        i = 0;
+      }
+      for (; i < c->nchunks; i++) {
         rid += c->cinfo[i].dgap;
         if (rid < c->min) {
           skip_chunk = i + 1;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index