[Groonga-commit] groonga/groonga at 03f2d75 [master] geo_in_circle: fix a crash bug

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Dec 13 23:22:57 JST 2013


Kouhei Sutou	2013-12-13 23:22:57 +0900 (Fri, 13 Dec 2013)

  New Revision: 03f2d750fa71207cf62f2c3338f93ed7c5be6f0e
  https://github.com/groonga/groonga/commit/03f2d750fa71207cf62f2c3338f93ed7c5be6f0e

  Message:
    geo_in_circle: fix a crash bug
    
    If you use "LATITUDExLONGITUDE" for "radius_or_point" parameter with
    index, Groonga crashes.

  Added files:
    test/command/suite/select/filter/geo_in_circle/use_inddex/north_east.expected
    test/command/suite/select/filter/geo_in_circle/use_inddex/north_east.test
  Modified files:
    lib/geo.c

  Modified: lib/geo.c (+5 -3)
===================================================================
--- lib/geo.c    2013-12-13 23:14:39 +0900 (d9f9524)
+++ lib/geo.c    2013-12-13 23:22:57 +0900 (1bb6214)
@@ -920,13 +920,15 @@ grn_geo_select_in_circle(grn_ctx *ctx, grn_obj *index,
   case GRN_DB_TEXT :
   case GRN_DB_LONG_TEXT :
     GRN_OBJ_INIT(&point_on_circle_, GRN_BULK, 0, domain);
-    if (grn_obj_cast(ctx, point_on_circle, &point_on_circle_, GRN_FALSE)) { goto exit; }
+    if (grn_obj_cast(ctx, distance, &point_on_circle_, GRN_FALSE)) { goto exit; }
     point_on_circle = &point_on_circle_;
     /* fallthru */
   case GRN_DB_TOKYO_GEO_POINT :
   case GRN_DB_WGS84_GEO_POINT :
-    if (domain != distance->header.domain) { /* todo */ goto exit; }
-    if (!point_on_circle) { point_on_circle = distance; }
+    if (!point_on_circle) {
+      if (domain != distance->header.domain) { /* todo */ goto exit; }
+      point_on_circle = distance;
+    }
     GRN_GEO_POINT_VALUE(point_on_circle,
                         on_circle.latitude, on_circle.longitude);
     d = distance_raw_func(ctx, center, &on_circle);

  Added: test/command/suite/select/filter/geo_in_circle/use_inddex/north_east.expected (+948 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/geo_in_circle/use_inddex/north_east.expected    2013-12-13 23:22:57 +0900 (f728eb8)
@@ -0,0 +1,948 @@
+select LandMarks --sortby '_id' --output_columns 'point' --limit -1   --filter 'geo_in_circle(point, "11x11", "11x1")'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        309
+      ],
+      [
+        [
+          "point",
+          "WGS84GeoPoint"
+        ]
+      ],
+      [
+        "2x7"
+      ],
+      [
+        "2x8"
+      ],
+      [
+        "2x9"
+      ],
+      [
+        "2x10"
+      ],
+      [
+        "2x11"
+      ],
+      [
+        "2x12"
+      ],
+      [
+        "2x13"
+      ],
+      [
+        "2x14"
+      ],
+      [
+        "2x15"
+      ],
+      [
+        "3x6"
+      ],
+      [
+        "3x7"
+      ],
+      [
+        "3x8"
+      ],
+      [
+        "3x9"
+      ],
+      [
+        "3x10"
+      ],
+      [
+        "3x11"
+      ],
+      [
+        "3x12"
+      ],
+      [
+        "3x13"
+      ],
+      [
+        "3x14"
+      ],
+      [
+        "3x15"
+      ],
+      [
+        "3x16"
+      ],
+      [
+        "4x4"
+      ],
+      [
+        "4x5"
+      ],
+      [
+        "4x6"
+      ],
+      [
+        "4x7"
+      ],
+      [
+        "4x8"
+      ],
+      [
+        "4x9"
+      ],
+      [
+        "4x10"
+      ],
+      [
+        "4x11"
+      ],
+      [
+        "4x12"
+      ],
+      [
+        "4x13"
+      ],
+      [
+        "4x14"
+      ],
+      [
+        "4x15"
+      ],
+      [
+        "4x16"
+      ],
+      [
+        "4x17"
+      ],
+      [
+        "4x18"
+      ],
+      [
+        "5x4"
+      ],
+      [
+        "5x5"
+      ],
+      [
+        "5x6"
+      ],
+      [
+        "5x7"
+      ],
+      [
+        "5x8"
+      ],
+      [
+        "5x9"
+      ],
+      [
+        "5x10"
+      ],
+      [
+        "5x11"
+      ],
+      [
+        "5x12"
+      ],
+      [
+        "5x13"
+      ],
+      [
+        "5x14"
+      ],
+      [
+        "5x15"
+      ],
+      [
+        "5x16"
+      ],
+      [
+        "5x17"
+      ],
+      [
+        "5x18"
+      ],
+      [
+        "6x3"
+      ],
+      [
+        "6x4"
+      ],
+      [
+        "6x5"
+      ],
+      [
+        "6x6"
+      ],
+      [
+        "6x7"
+      ],
+      [
+        "6x8"
+      ],
+      [
+        "6x9"
+      ],
+      [
+        "6x10"
+      ],
+      [
+        "6x11"
+      ],
+      [
+        "6x12"
+      ],
+      [
+        "6x13"
+      ],
+      [
+        "6x14"
+      ],
+      [
+        "6x15"
+      ],
+      [
+        "6x16"
+      ],
+      [
+        "6x17"
+      ],
+      [
+        "6x18"
+      ],
+      [
+        "6x19"
+      ],
+      [
+        "7x2"
+      ],
+      [
+        "7x3"
+      ],
+      [
+        "7x4"
+      ],
+      [
+        "7x5"
+      ],
+      [
+        "7x6"
+      ],
+      [
+        "7x7"
+      ],
+      [
+        "7x8"
+      ],
+      [
+        "7x9"
+      ],
+      [
+        "7x10"
+      ],
+      [
+        "7x11"
+      ],
+      [
+        "7x12"
+      ],
+      [
+        "7x13"
+      ],
+      [
+        "7x14"
+      ],
+      [
+        "7x15"
+      ],
+      [
+        "7x16"
+      ],
+      [
+        "7x17"
+      ],
+      [
+        "7x18"
+      ],
+      [
+        "7x19"
+      ],
+      [
+        "7x20"
+      ],
+      [
+        "8x2"
+      ],
+      [
+        "8x3"
+      ],
+      [
+        "8x4"
+      ],
+      [
+        "8x5"
+      ],
+      [
+        "8x6"
+      ],
+      [
+        "8x7"
+      ],
+      [
+        "8x8"
+      ],
+      [
+        "8x9"
+      ],
+      [
+        "8x10"
+      ],
+      [
+        "8x11"
+      ],
+      [
+        "8x12"
+      ],
+      [
+        "8x13"
+      ],
+      [
+        "8x14"
+      ],
+      [
+        "8x15"
+      ],
+      [
+        "8x16"
+      ],
+      [
+        "8x17"
+      ],
+      [
+        "8x18"
+      ],
+      [
+        "8x19"
+      ],
+      [
+        "8x20"
+      ],
+      [
+        "9x2"
+      ],
+      [
+        "9x3"
+      ],
+      [
+        "9x4"
+      ],
+      [
+        "9x5"
+      ],
+      [
+        "9x6"
+      ],
+      [
+        "9x7"
+      ],
+      [
+        "9x8"
+      ],
+      [
+        "9x9"
+      ],
+      [
+        "9x10"
+      ],
+      [
+        "9x11"
+      ],
+      [
+        "9x12"
+      ],
+      [
+        "9x13"
+      ],
+      [
+        "9x14"
+      ],
+      [
+        "9x15"
+      ],
+      [
+        "9x16"
+      ],
+      [
+        "9x17"
+      ],
+      [
+        "9x18"
+      ],
+      [
+        "9x19"
+      ],
+      [
+        "9x20"
+      ],
+      [
+        "10x2"
+      ],
+      [
+        "10x3"
+      ],
+      [
+        "10x4"
+      ],
+      [
+        "10x5"
+      ],
+      [
+        "10x6"
+      ],
+      [
+        "10x7"
+      ],
+      [
+        "10x8"
+      ],
+      [
+        "10x9"
+      ],
+      [
+        "10x10"
+      ],
+      [
+        "10x11"
+      ],
+      [
+        "10x12"
+      ],
+      [
+        "10x13"
+      ],
+      [
+        "10x14"
+      ],
+      [
+        "10x15"
+      ],
+      [
+        "10x16"
+      ],
+      [
+        "10x17"
+      ],
+      [
+        "10x18"
+      ],
+      [
+        "10x19"
+      ],
+      [
+        "10x20"
+      ],
+      [
+        "11x1"
+      ],
+      [
+        "11x2"
+      ],
+      [
+        "11x3"
+      ],
+      [
+        "11x4"
+      ],
+      [
+        "11x5"
+      ],
+      [
+        "11x6"
+      ],
+      [
+        "11x7"
+      ],
+      [
+        "11x8"
+      ],
+      [
+        "11x9"
+      ],
+      [
+        "11x10"
+      ],
+      [
+        "11x11"
+      ],
+      [
+        "11x12"
+      ],
+      [
+        "11x13"
+      ],
+      [
+        "11x14"
+      ],
+      [
+        "11x15"
+      ],
+      [
+        "11x16"
+      ],
+      [
+        "11x17"
+      ],
+      [
+        "11x18"
+      ],
+      [
+        "11x19"
+      ],
+      [
+        "11x20"
+      ],
+      [
+        "11x21"
+      ],
+      [
+        "12x2"
+      ],
+      [
+        "12x3"
+      ],
+      [
+        "12x4"
+      ],
+      [
+        "12x5"
+      ],
+      [
+        "12x6"
+      ],
+      [
+        "12x7"
+      ],
+      [
+        "12x8"
+      ],
+      [
+        "12x9"
+      ],
+      [
+        "12x10"
+      ],
+      [
+        "12x11"
+      ],
+      [
+        "12x12"
+      ],
+      [
+        "12x13"
+      ],
+      [
+        "12x14"
+      ],
+      [
+        "12x15"
+      ],
+      [
+        "12x16"
+      ],
+      [
+        "12x17"
+      ],
+      [
+        "12x18"
+      ],
+      [
+        "12x19"
+      ],
+      [
+        "12x20"
+      ],
+      [
+        "13x2"
+      ],
+      [
+        "13x3"
+      ],
+      [
+        "13x4"
+      ],
+      [
+        "13x5"
+      ],
+      [
+        "13x6"
+      ],
+      [
+        "13x7"
+      ],
+      [
+        "13x8"
+      ],
+      [
+        "13x9"
+      ],
+      [
+        "13x10"
+      ],
+      [
+        "13x11"
+      ],
+      [
+        "13x12"
+      ],
+      [
+        "13x13"
+      ],
+      [
+        "13x14"
+      ],
+      [
+        "13x15"
+      ],
+      [
+        "13x16"
+      ],
+      [
+        "13x17"
+      ],
+      [
+        "13x18"
+      ],
+      [
+        "13x19"
+      ],
+      [
+        "13x20"
+      ],
+      [
+        "14x2"
+      ],
+      [
+        "14x3"
+      ],
+      [
+        "14x4"
+      ],
+      [
+        "14x5"
+      ],
+      [
+        "14x6"
+      ],
+      [
+        "14x7"
+      ],
+      [
+        "14x8"
+      ],
+      [
+        "14x9"
+      ],
+      [
+        "14x10"
+      ],
+      [
+        "14x11"
+      ],
+      [
+        "14x12"
+      ],
+      [
+        "14x13"
+      ],
+      [
+        "14x14"
+      ],
+      [
+        "14x15"
+      ],
+      [
+        "14x16"
+      ],
+      [
+        "14x17"
+      ],
+      [
+        "14x18"
+      ],
+      [
+        "14x19"
+      ],
+      [
+        "14x20"
+      ],
+      [
+        "15x2"
+      ],
+      [
+        "15x3"
+      ],
+      [
+        "15x4"
+      ],
+      [
+        "15x5"
+      ],
+      [
+        "15x6"
+      ],
+      [
+        "15x7"
+      ],
+      [
+        "15x8"
+      ],
+      [
+        "15x9"
+      ],
+      [
+        "15x10"
+      ],
+      [
+        "15x11"
+      ],
+      [
+        "15x12"
+      ],
+      [
+        "15x13"
+      ],
+      [
+        "15x14"
+      ],
+      [
+        "15x15"
+      ],
+      [
+        "15x16"
+      ],
+      [
+        "15x17"
+      ],
+      [
+        "15x18"
+      ],
+      [
+        "15x19"
+      ],
+      [
+        "15x20"
+      ],
+      [
+        "16x3"
+      ],
+      [
+        "16x4"
+      ],
+      [
+        "16x5"
+      ],
+      [
+        "16x6"
+      ],
+      [
+        "16x7"
+      ],
+      [
+        "16x8"
+      ],
+      [
+        "16x9"
+      ],
+      [
+        "16x10"
+      ],
+      [
+        "16x11"
+      ],
+      [
+        "16x12"
+      ],
+      [
+        "16x13"
+      ],
+      [
+        "16x14"
+      ],
+      [
+        "16x15"
+      ],
+      [
+        "16x16"
+      ],
+      [
+        "16x17"
+      ],
+      [
+        "16x18"
+      ],
+      [
+        "16x19"
+      ],
+      [
+        "17x3"
+      ],
+      [
+        "17x4"
+      ],
+      [
+        "17x5"
+      ],
+      [
+        "17x6"
+      ],
+      [
+        "17x7"
+      ],
+      [
+        "17x8"
+      ],
+      [
+        "17x9"
+      ],
+      [
+        "17x10"
+      ],
+      [
+        "17x11"
+      ],
+      [
+        "17x12"
+      ],
+      [
+        "17x13"
+      ],
+      [
+        "17x14"
+      ],
+      [
+        "17x15"
+      ],
+      [
+        "17x16"
+      ],
+      [
+        "17x17"
+      ],
+      [
+        "17x18"
+      ],
+      [
+        "17x19"
+      ],
+      [
+        "18x4"
+      ],
+      [
+        "18x5"
+      ],
+      [
+        "18x6"
+      ],
+      [
+        "18x7"
+      ],
+      [
+        "18x8"
+      ],
+      [
+        "18x9"
+      ],
+      [
+        "18x10"
+      ],
+      [
+        "18x11"
+      ],
+      [
+        "18x12"
+      ],
+      [
+        "18x13"
+      ],
+      [
+        "18x14"
+      ],
+      [
+        "18x15"
+      ],
+      [
+        "18x16"
+      ],
+      [
+        "18x17"
+      ],
+      [
+        "18x18"
+      ],
+      [
+        "19x6"
+      ],
+      [
+        "19x7"
+      ],
+      [
+        "19x8"
+      ],
+      [
+        "19x9"
+      ],
+      [
+        "19x10"
+      ],
+      [
+        "19x11"
+      ],
+      [
+        "19x12"
+      ],
+      [
+        "19x13"
+      ],
+      [
+        "19x14"
+      ],
+      [
+        "19x15"
+      ],
+      [
+        "19x16"
+      ],
+      [
+        "20x7"
+      ],
+      [
+        "20x8"
+      ],
+      [
+        "20x9"
+      ],
+      [
+        "20x10"
+      ],
+      [
+        "20x11"
+      ],
+      [
+        "20x12"
+      ],
+      [
+        "20x13"
+      ],
+      [
+        "20x14"
+      ],
+      [
+        "20x15"
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/filter/geo_in_circle/use_inddex/north_east.test (+4 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/geo_in_circle/use_inddex/north_east.test    2013-12-13 23:22:57 +0900 (0f20692)
@@ -0,0 +1,4 @@
+#@include fixture/geo/in_circle/north_east.grn
+
+select LandMarks --sortby '_id' --output_columns 'point' --limit -1 \
+  --filter 'geo_in_circle(point, "11x11", "11x1")'
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index