[MDEV-22738] *SAN: sql/sql_select.cc:24493:22: runtime error: load of value 3200171710, which is not a valid value for type 'enum_parsing_place' (on optimized builds) Created: 2020-05-28  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Stored routines
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: not-10.1


 Description   

USE test;
CREATE TABLE t(c INT, c2 GEOMETRY NOT NULL, c3 GEOMETRY NOT NULL);
PREPARE p FROM "UPDATE t SET b = 1";

Leads to:

10.5.4 c2a929185c147fc85bbf91e2c537bcdd98f2e680

/test/10.5_opt/sql/sql_select.cc:24493:22: runtime error: load of value 3200171710, which is not a valid value for type 'enum_parsing_place'

Compiled with GCC >=7.5.0 and:
    -DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWITH_RAPID=OFF
Set before execution:
    export ASAN_OPTIONS=quarantine_size_mb=512:atexit=true:detect_invalid_pointer_pairs=1:dump_instruction_bytes=true:abort_on_error=1

Bug confirmed present in:
MariaDB: 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt), 10.4.14 (dbg), 10.4.14 (opt), 10.5.4 (dbg), 10.5.4 (opt)

Bug confirmed not present in:
MariaDB: 10.1.46 (dbg), 10.1.46 (opt)



 Comments   
Comment by Alexander Barkov [ 2020-05-29 ]

The problem is not related to GEOMETRY and is repeatable with this script:

CREATE OR REPLACE TABLE t1(c INT, c2 INT NOT NULL, c3 INT NOT NULL);
PREPARE p FROM "UPDATE t SET b = 1";

24489	int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
24490	                List<Item> &fields, List<Item> &all_fields, ORDER *order,
24491	                bool from_window_spec)
24492	{ 
24493	  enum_parsing_place context_analysis_place=
24494	                     thd->lex->current_select->context_analysis_place;
24495	  thd->where="order clause";
24496	  for (; order; order=order->next)
24497	  {
24498	    if (find_order_in_list(thd, ref_pointer_array, tables, order, fields,
(gdb) p thd->lex->current_select->context_analysis_place;
Invalid character ';' in expression.
(gdb) p thd->lex->current_select->context_analysis_place
$3 = 2779096485

Notice, thd->lex->current_select->context_analysis_place looks not initialized properly.

Generated at Thu Feb 08 09:17:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.