Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26161

crash in Gis_point::calculate_haversine

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6.3, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6
    • 10.5, 10.6
    • GIS
    • None
    • Linux x64

    Description

       
      Version: '10.6.3-MariaDB'  MariaDB Server
       
      Thread 26 "mysqld" received signal SIGSEGV, Segmentation fault.
      (gdb) bt
      #0  in Gis_point::calculate_haversine at ./sql/spatial.cc:1112
      #1  in Gis_multi_point::spherical_distance_multipoints at ./sql/spatial.cc:2365
      #2  in Item_func_sphere_distance::spherical_distance_points at ./sql/item_geofunc.cc:2637
      #3  in Item_func_sphere_distance::val_real at ./sql/item_geofunc.cc:2568
      #4  in Item_func::is_null at ./sql/item_func.h:176
      #5  in mysql_do at ./sql/sql_do.cc:35
      #6  in mysql_execute_command at ./sql/sql_parse.cc:3976
      #7  in mysql_parse at ./sql/sql_parse.cc:8026
      #8  in dispatch_command at ./sql/sql_parse.cc:1896
      #9  in do_command at ./sql/sql_parse.cc:1405
      #10 in do_handle_one_connection at ./sql/sql_connect.cc:1410
      #11 in handle_one_connection at ./sql/sql_connect.cc:1312
      #12 in pfs_spawn_thread at ./storage/perfschema/pfs.cc:2201
      

      Testcase

      do st_distance_sphere(
       st_asbinary(
        polygon(
         linestring(
          point(-19655,-18908), 
          point(-10261,-7746), 
          point(31432,-18255), 
          point(-19655,-18908)
         ),
         linestring(
          point(-10494,19004),
          point(-18181,-24299),
          point(20616,19685),
          point(-10494,19004)
         ),
         linestring(
          point(8904,-21761),
          point(-24528,3798),
          point(-2502,-2889),
          point(8904,-21761)
         ),
         linestring(
          point(-7451,-19434),
          point(-30558,-27426),
          point(19086,17469),
          point(-7451,-19434)
         )
        )
       ),
       multipoint(
        point(124,204)
       ),
       3232164176
      );
      

      Attachments

        Issue Links

          Activity

            holyfoot thanks for the comment.
            However still this will not work:

            ST_DISTANCE_SPHERE(ST_AsBinary(@poly), ST_GEOMFROMTEXT('POINT(2 0)'))
            

            Note that it works in MySQL:

            • MySQL (@poly =NULL and also for @poly !=NULL) :

              +-----------------------------------------------------------------------+
              | ST_DISTANCE_SPHERE(ST_AsBinary(@poly), ST_GEOMFROMTEXT('POINT(2 0)')) |
              +-----------------------------------------------------------------------+
              |                                                                  NULL |
              +-----------------------------------------------------------------------+
              

            and suggested approach will not solve it.

            When updated per your suggestion, I get the error ER_GIS_INVALID_DATA, since ST_ASBINARY is WKB -> Item_func_as_wkb::field_type() = MYSQL_TYPE_BLOB, but we want to get rid of MYSQL_TYPE_BLOB because of the current MDEV. Should MDEV-27666 be solved first? What do you suggest as an solution to implement ?

            However here is the commit 3136b68d3be061dd99

            anel Anel Husakovic added a comment - holyfoot thanks for the comment. However still this will not work: ST_DISTANCE_SPHERE(ST_AsBinary(@poly), ST_GEOMFROMTEXT( 'POINT(2 0)' )) Note that it works in MySQL: MySQL ( @poly =NULL and also for @poly !=NULL ) : + -----------------------------------------------------------------------+ | ST_DISTANCE_SPHERE(ST_AsBinary(@poly), ST_GEOMFROMTEXT( 'POINT(2 0)' )) | + -----------------------------------------------------------------------+ | NULL | + -----------------------------------------------------------------------+ and suggested approach will not solve it. When updated per your suggestion, I get the error ER_GIS_INVALID_DATA , since ST_ASBINARY is WKB -> Item_func_as_wkb::field_type() = MYSQL_TYPE_BLOB , but we want to get rid of MYSQL_TYPE_BLOB because of the current MDEV. Should MDEV-27666 be solved first? What do you suggest as an solution to implement ? However here is the commit 3136b68d3be061dd99

            ok to push.

            holyfoot Alexey Botchkov added a comment - ok to push.

            Hi holyfoot any update on this?

            anel Anel Husakovic added a comment - Hi holyfoot any update on this?

            I increased priority to blocker as this is a crash that looks like anyone could get

            monty Michael Widenius added a comment - I increased priority to blocker as this is a crash that looks like anyone could get

            The fix was pushed so the server doesn't crash, we get the BAD GEOMETRY error instead.
            Still it'd be good to fix it properly so the types of the arguments are cheked to produce more meaningful error when non-geometry data is sent.

            holyfoot Alexey Botchkov added a comment - The fix was pushed so the server doesn't crash, we get the BAD GEOMETRY error instead. Still it'd be good to fix it properly so the types of the arguments are cheked to produce more meaningful error when non-geometry data is sent.

            People

              holyfoot Alexey Botchkov
              sbester1 sbester1
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.