Skip to content
Permalink
Browse files
ma_check/mi_check: maria_repair_parallel initialization for !quick
end_io_call uses uninitialized values from the new_data_cache

As such we the buffer 0 and check this before calling end_io_cache on it.

Thanks Sergey Vojtovich for the review and for this solution.

Found by Coverity (ref 972481).
  • Loading branch information
grooverdan authored and Sergey Vojtovich committed Jul 18, 2017
1 parent 7d309b5 commit c9883b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
@@ -4250,6 +4250,8 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
}
*/
DBUG_PRINT("info", ("is quick repair: %d", (int) rep_quick));
if (!rep_quick)
my_b_clear(&new_data_cache);

/* Initialize pthread structures before goto err. */
mysql_mutex_init(key_SORT_INFO_mutex, &sort_info.mutex, MY_MUTEX_INIT_FAST);
@@ -4608,7 +4610,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
already or they were not yet started (if the error happend before
creating the threads).
*/
if (!rep_quick)
if (!rep_quick && my_b_inited(&new_data_cache))
end_io_cache(&new_data_cache);
if (!got_error)
{
@@ -2676,6 +2676,8 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info,
*/
DBUG_PRINT("info", ("is quick repair: %d", rep_quick));
bzero((char*)&sort_info,sizeof(sort_info));
if (!rep_quick)
my_b_clear(&new_data_cache);
/* Initialize pthread structures before goto err. */
mysql_mutex_init(mi_key_mutex_MI_SORT_INFO_mutex,
&sort_info.mutex, MY_MUTEX_INIT_FAST);
@@ -3050,7 +3052,7 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info,
already or they were not yet started (if the error happend before
creating the threads).
*/
if (!rep_quick)
if (!rep_quick && my_b_inited(&new_data_cache))
(void) end_io_cache(&new_data_cache);
if (!got_error)
{

0 comments on commit c9883b7

Please sign in to comment.