[MDEV-11707] Fix incorrect memset() for structures containing dynamic class GenericPolicy<TTASEventMutex<GenericPolicy> >'; vtable Created: 2017-01-03  Updated: 2017-02-06  Resolved: 2017-02-06

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Storage Engine - XtraDB
Affects Version/s: 10.1
Fix Version/s: 10.1.22, 10.2.4

Type: Bug Priority: Major
Reporter: Jan Lindström (Inactive) Assignee: Jan Lindström (Inactive)
Resolution: Fixed Votes: 0
Labels: 10.2-rc


 Comments   
Comment by Jan Lindström (Inactive) [ 2017-01-03 ]

storage/innobase/buf/buf0mtflu.cc:489:9: warning:
destination for this 'memset' call is a pointer to class containing a
dynamic class 'GenericPolicy<TTASEventMutex<GenericPolicy> >'; vtable
pointer will be overwritten [-Wdynamic-class-memaccess]
memset(mtflush_ctx, 0, sizeof(thread_sync_t));

Comment by Jan Lindström (Inactive) [ 2017-01-23 ]

http://lists.askmonty.org/pipermail/commits/2017-January/010483.html

Comment by Marko Mäkelä [ 2017-01-30 ]

I think that a much better fix is to backport this one from 10.2:

commit a8ac6dc5065a82b11b3f1a699be87aabc95d7a10
Author: Marko Mäkelä <marko.makela@mariadb.com>
Date:   Thu Jan 5 11:49:00 2017 +0200
 
    Fix InnoDB compilation warnings.

Comment by Jan Lindström (Inactive) [ 2017-02-06 ]

Your suggested fix looks good but for GA-release I rather apply minimal changes.

commit e53dfb24be73a204b4ee8efee6c07e1b13200052
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date: Mon Feb 6 10:55:23 2017 +0200

MDEV-11707: Fix incorrect memset() for structures containing

dynamic class GenericPolicy<TTASEventMutex<GenericPolicy> >'; vtable

Instead using mem_heap_alloc and memset, use mem_heap_zalloc
directly.

Generated at Thu Feb 08 07:52:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.