diff options
author | Thiago Macieira <thiago@kde.org> | 2011-07-08 10:42:49 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-08 11:22:30 +0200 |
commit | d96b7b809e614dd416709acec768529457120b9f (patch) | |
tree | aaa1db4cb1bf11beda0136fe9dbe59ff6ea9fdfd | |
parent | 948d051fb145ad486e0409cb219bab9616328502 (diff) |
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>
-rw-r--r-- | src/corelib/tools/qlist.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index 80c610be36..14dfc6a139 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -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)); |