Use memmove in QListData::append(int) as regions overlap.
It's undefined behaviour to memcpy regions with overlapping area. You have to use memmove. Change-Id: I912c819bf7ab26ba1e60028ee9d7c833dfc5138a Reviewed-on: http://codereview.qt.nokia.com/1355 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
This commit is contained in:
parent
948d051fb1
commit
d96b7b809e
@ -164,7 +164,7 @@ void **QListData::append(int n)
|
||||
if (b - n >= 2 * d->alloc / 3) {
|
||||
// we have enough space. Just not at the end -> move it.
|
||||
e -= b;
|
||||
::memcpy(d->array, d->array + b, e * sizeof(void *));
|
||||
::memmove(d->array, d->array + b, e * sizeof(void *));
|
||||
d->begin = 0;
|
||||
} else {
|
||||
realloc(grow(d->alloc + n));
|
||||
|
Loading…
Reference in New Issue
Block a user