summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorThiago Macieira <thiago@kde.org>2011-07-08 08:42:49 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-07-08 12:10:16 (GMT)
commit9eb176928280acaabcee99d52c2379ddd3a44490 (patch)
tree61eda02fda1c3762186778160b1e785fc3d6c4f2 /src/corelib/tools
parent999047177846695a809aa1a730330ce676d85959 (diff)
downloadQt-9eb176928280acaabcee99d52c2379ddd3a44490.zip
Qt-9eb176928280acaabcee99d52c2379ddd3a44490.tar.gz
Qt-9eb176928280acaabcee99d52c2379ddd3a44490.tar.bz2
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> (cherry picked from commit d96b7b809e614dd416709acec768529457120b9f)
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qlist.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 36a9c60..e68ddd5 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -237,7 +237,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));