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

Large variety of stacks and stack looping on GIS/JSON based SELECT w/ different CS/ES outcomes

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      SELECT ST_GEOMFROMGEOJSON(CONCAT (REPEAT('{"type":"GEOMETRYCOLLECTION","geometries":[',2000),0,REPEAT(']}',2000))) AS exp;
      

      Leads to:

      CS 13.1.0 0ee34e07bdc10abf32a535d7234c6f5e0bb9ed55 (Optimized, Clang 22.1.8-20260622) Build 14/08/2026

      Core was generated by `/test/MD140826-mariadb-13.1.0-linux-x86_64-opt/bin/mariadbd --no-defaults --loo'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x000060ddd38ff3e8 in read_array (j=0x707bf4018ea0)at /test/13.1_opt/strings/json_lib.c:202
      202	{
      [Current thread is 1 (LWP 3871457)]
      (gdb) bt
      #0  0x000060ddd38ff3e8 in read_array (j=0x707bf4018ea0)at /test/13.1_opt/strings/json_lib.c:202
      #1  0x000060ddd38fb35f in json_read_value (j=0x707bf4018ea0)at /test/13.1_opt/strings/json_lib.c:1031
      #2  0x000060ddd350bc56 in Gis_geometry_collection::init_from_json (this=<optimized out>, je=0x707bf405395d, er_on_3D=93, wkb=0x60ddd43eee10 <json_actions>) at /test/13.1_opt/sql/spatial.cc:4483
      #3  0x000060ddd3502d95 in Geometry::create_from_json (buffer=buffer@entry=0x787ce40382d8, je=je@entry=0x707bf4018ea0, er_on_3D=false, res=res@entry=0x787ce407f290)at /test/13.1_opt/sql/spatial.cc:768
      #4  0x000060ddd350bd1c in Gis_geometry_collection::init_from_json (this=<optimized out>, je=0x707bf4018ea0, er_on_3D=<optimized out>, wkb=0x787ce407f290) at /test/13.1_opt/sql/spatial.cc:4502
      ... repeated ...
      #280 0x000060ddd350bd1c in Gis_geometry_collection::init_from_json (this=<optimized out>, je=0x707bf4018ea0, er_on_3D=<optimized out>, wkb=0x787ce407f290) at /test/13.1_opt/sql/spatial.cc:4502
      #281 0x000060ddd3502d95 in Geometry::create_from_json (buffer=buffer@entry=0x787ce4047618, je=je@entry=0x707bf4018ea0, er_on_3D=false, res=res@entry=0x787ce407f290)at /test/13.1_opt/sql/spatial.cc:768
      #282 0x000060ddd350bd1c in Gis_geometry_collection::init_from_json (this=<optimized out>, je=0x707bf4018ea0, er_on_3D=<optimized out>, wkb=0x787ce407f290) at /test/13.1_opt/sql/spatial.cc:4502
      #283 0x000060ddd3502d95 in Geometry::create_from_json (buffer=buffer@entry=0x787ce40477d8, je=je@entry=0x707bf4018ea0, er_on_3D=false, res=res@entry=0x787ce407f290)at /test/13.1_opt/sql/spatial.cc:768
      #284 0x000060ddd350bd1c in Gis_geometry_collection::init_from_json (this=<optimized out>, je=0x707bf4018ea0, er_on_3D=<optimized out>, wkb=0x787ce407f290) at /test/13.1_opt/sql/spatial.cc:4502
      

      CS 13.1.0 0ee34e07bdc10abf32a535d7234c6f5e0bb9ed55 (Debug, Clang 22.1.8-20260622) Build 14/08/2026

      Core was generated by `/test/MD140826-mariadb-13.1.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --loo'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x00005c915a1c467c in my_mb_wc_utf8mb4_quick (pwc=0x6f3aec01b730, s=0x6f3aec055423 "{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\""..., e=0x6f3aec065421 "") at /test/13.1_dbg/strings/ctype-utf8.h:145
      145	  c= s[0];
      [Current thread is 1 (LWP 3874925)]
      (gdb) bt
      #0  0x00005c915a1c467c in my_mb_wc_utf8mb4_quick (pwc=0x6f3aec01b730, s=0x6f3aec055423 "{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\""..., e=0x6f3aec065421 "") at /test/13.1_dbg/strings/ctype-utf8.h:145
      #1  0x00005c915a1bdda9 in my_mb_wc_utf8mb4 (cs=0x5c9183a2b938, pwc=0x6f3aec01b730, s=0x6f3aec055423 "{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\",\"geometries\":[{\"type\":\"GEOMETRYCOLLECTION\""..., e=0x6f3aec065421 "")at /test/13.1_dbg/strings/ctype-utf8.c:2828
      #2  0x00005c915a1de68d in get_first_nonspace (js=0x6f3aec01b720, t_next=0x773bfc0dc09c, c_len=0x773bfc0dc098)at /test/13.1_dbg/strings/json_lib.c:754
      #3  0x00005c915a1de5f9 in json_read_value (j=0x6f3aec01b720)at /test/13.1_dbg/strings/json_lib.c:1028
      #4  0x00005c9159a5f6cc in Geometry::create_from_json (buffer=0x773bfc0dc280, je=0x6f3aec01b720, er_on_3D=false, res=0x773bfc121240)at /test/13.1_dbg/sql/spatial.cc:593
      #5  0x00005c9159a6ba13 in Gis_geometry_collection::init_from_json (this=0x773bfc0dc470, je=0x6f3aec01b720, er_on_3D=false, wkb=0x773bfc121240)at /test/13.1_dbg/sql/spatial.cc:4502
      #6  0x00005c9159a5fc1f in Geometry::create_from_json (buffer=0x773bfc0dc470, je=0x6f3aec01b720, er_on_3D=false, res=0x773bfc121240)at /test/13.1_dbg/sql/spatial.cc:768
      #7  0x00005c9159a6ba13 in Gis_geometry_collection::init_from_json (this=0x773bfc0dc660, je=0x6f3aec01b720, er_on_3D=false, wkb=0x773bfc121240)at /test/13.1_dbg/sql/spatial.cc:4502
      #8  0x00005c9159a5fc1f in Geometry::create_from_json (buffer=0x773bfc0dc660, je=0x6f3aec01b720, er_on_3D=false, res=0x773bfc121240)at /test/13.1_dbg/sql/spatial.cc:768
      #9  0x00005c9159a6ba13 in Gis_geometry_collection::init_from_json (this=0x773bfc0dc850, je=0x6f3aec01b720, er_on_3D=false, wkb=0x773bfc121240)at /test/13.1_dbg/sql/spatial.cc:4502
      #10 0x00005c9159a5fc1f in Geometry::create_from_json (buffer=0x773bfc0dc850, je=0x6f3aec01b720, er_on_3D=false, res=0x773bfc121240)at /test/13.1_dbg/sql/spatial.cc:768
      ... repeated ...
      #328 0x00005c9159a5fc1f in Geometry::create_from_json (buffer=0x773bfc0efc60, je=0x6f3aec01b720, er_on_3D=false, res=0x773bfc121240)at /test/13.1_dbg/sql/spatial.cc:768
      #329 0x00005c9159a6ba13 in Gis_geometry_collection::init_from_json (this=0x773bfc0efe50, je=0x6f3aec01b720, er_on_3D=false, wkb=0x773bfc121240)at /test/13.1_dbg/sql/spatial.cc:4502
      #330 0x00005c9159a5fc1f in Geometry::create_from_json (buffer=0x773bfc0efe50, je=0x6f3aec01b720, er_on_3D=false, res=0x773bfc121240)at /test/13.1_dbg/sql/spatial.cc:768
      #331 0x00005c9159a6ba13 in Gis_geometry_collection::init_from_json (this=0x773bfc0f0040, je=0x6f3aec01b720, er_on_3D=false, wkb=0x773bfc121240)
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  220726  5520c9aac5b6a5a9ea60d78582ddffa5349e2d0f  No bug found                  
      CS  10.6   opt  220726  5520c9aac5b6a5a9ea60d78582ddffa5349e2d0f  No bug found                  
      CS  10.11  dbg  220726  6268f6023fe3e8dc8ec81869dea711e14cbb28c3  No bug found                  
      CS  10.11  opt  220726  6268f6023fe3e8dc8ec81869dea711e14cbb28c3  No bug found                  
      CS  11.4   dbg  220726  2cbce592c39dd39902c8f03db2b35069832fd10b  No bug found                  
      CS  11.4   opt  220726  2cbce592c39dd39902c8f03db2b35069832fd10b  No bug found                  
      CS  11.8   dbg  220726  1d23deff797ab448f091e39756434903d81a98c2  No bug found                  
      CS  11.8   opt  220726  1d23deff797ab448f091e39756434903d81a98c2  No bug found                  
      CS  12.3   dbg  220726  9b075b2cb53338f67e7230cc585e02d2d34514ed  SIGSEGV|my_mb_wc_utf8mb4_quick|my_mb_wc_utf8mb4|skip_str_constant|read_strn
      CS  12.3   opt  220726  9b075b2cb53338f67e7230cc585e02d2d34514ed  SIGSEGV|read_array|json_read_value|Gis_geometry_collection::init_from_json|Geometry::create_from_json
      CS  13.0   dbg  220726  84c246ca5387c0611f75097136ff4f4bea092aa3  SIGSEGV|my_mb_wc_utf8mb4_quick|my_mb_wc_utf8mb4|skip_str_constant|read_strn
      CS  13.0   opt  220726  84c246ca5387c0611f75097136ff4f4bea092aa3  SIGSEGV|read_array|json_read_value|Gis_geometry_collection::init_from_json|Geometry::create_from_json
      CS  13.1   dbg  140826  0ee34e07bdc10abf32a535d7234c6f5e0bb9ed55  SIGSEGV|my_mb_wc_utf8mb4_quick|my_mb_wc_utf8mb4|get_first_nonspace|json_read_value
      CS  13.1   opt  140826  0ee34e07bdc10abf32a535d7234c6f5e0bb9ed55  SIGSEGV|read_array|json_read_value|Gis_geometry_collection::init_from_json|Geometry::create_from_json
      ES  10.6   dbg  220726  fcecb2620f25965723d640decede7c018bcb1dcc  SIGSEGV|my_utf8mb3_uni|get_first_nonspace|json_read_value|Gis_geometry_collection::init_from_json
      ES  10.6   opt  220726  fcecb2620f25965723d640decede7c018bcb1dcc  SIGSEGV|Gis_geometry_collection::init_from_json|Geometry::create_from_json|Gis_geometry_collection::init_from_json|Geometry::create_from_json
      ES  11.4   dbg  220726  3b34189bfe675c18c4ced3ef531d016ea74c76f4  SIGSEGV|my_mb_wc_utf8mb3_quick|my_utf8mb3_uni|get_first_nonspace|json_read_value
      ES  11.4   opt  220726  3b34189bfe675c18c4ced3ef531d016ea74c76f4  SIGSEGV|Geometry::create_from_json|Gis_geometry_collection::init_from_json|Geometry::create_from_json|Gis_geometry_collection::init_from_json
      ES  11.8   dbg  220726  4694e931d10fecf733c34f83ea2146d31b708eb3  SIGSEGV|json_read_value|Gis_geometry_collection::init_from_json|Geometry::create_from_json|Gis_geometry_collection::init_from_json
      ES  11.8   opt  220726  4694e931d10fecf733c34f83ea2146d31b708eb3  SIGSEGV|Gis_geometry_collection::init_from_json|Geometry::create_from_json|Gis_geometry_collection::init_from_json|Geometry::create_from_json
      ES  12.3   dbg  220726  9d8abb61e913bec023cd8caeccad4b42717151cb  SIGSEGV|my_mb_wc_utf8mb4|get_first_nonspace|json_read_value|Geometry::create_from_json
      ES  12.3   opt  220726  9d8abb61e913bec023cd8caeccad4b42717151cb  SIGSEGV|read_array|json_read_value|Gis_geometry_collection::init_from_json|Geometry::create_from_json
      MS  5.5    dbg  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.5    opt  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.6    dbg  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.6    opt  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.7    dbg  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  5.7    opt  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  8.0    dbg  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  8.0    opt  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  9.1    dbg  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      MS  9.1    opt  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 1h
                  1h

                  Git Integration

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