Bug #88175 A Potential NULL Pointer Exception
Submitted: 22 Oct 2017 6:43 Modified: 22 Oct 2017 8:07
Reporter: Tom Shi Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[22 Oct 2017 6:43] Tom Shi
Description:
At https://github.com/mysql/mysql-server/blob/5.7/sql/sql_udf.cc#L187

The 3rd argument is non-NULL
The 4th argument is NULL

if (init_read_record(&read_record_info, new_thd, table, NULL, 1, 1, FALSE)) {
 ...
}

In function init_read_record at https://github.com/mysql/mysql-server/blob/5.7/sql/records.cc#L192

bool init_read_record(READ_RECORD *info,THD *thd,
                      TABLE *table, QEP_TAB *qep_tab,
		      int use_record_cache, bool print_error, 
                      bool disable_rr_cache)
{
  int error= 0;
  IO_CACHE *tempfile;
  DBUG_ENTER("init_read_record");

  DBUG_ASSERT(!(table && qep_tab));   // --> this will fail because at the above call site, table is non-null but qep_tab is null.
  if (!table)
    table= qep_tab->table();  // --> table is non-null, gep_table is null, thus an null pointer exception may happen here.

How to repeat:
As shown in the description part.
[22 Oct 2017 7:47] Tom Shi
Sorry, I made a mistake... this is not a bug. Please close. Sorry again.