Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/4202
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/libexttextcat refs/changes/02/4202/1
Don't use overlapping memcpy in heapextract.
Calling memcpy with source and destination overlapping might result in
unexpected results. In this case it was also useless since it was trying
to copy an element that was going to be removed immediately afterwards.
Change-Id: I20852eed68aaf956c8597442a986d37ff21e106a
---
M src/fingerprint.c
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/fingerprint.c b/src/fingerprint.c
index e17d83e..428b8df 100644
--- a/src/fingerprint.c
+++ b/src/fingerprint.c
@@ -254,7 +254,8 @@
p = &(t->heap[0]);
memcpy(item, p, sizeof(entry_t));
- memcpy(&(t->heap[0]), &(t->heap[t->size - 1]), sizeof(entry_t));
+ if (t->size > 1)
+ memcpy(&(t->heap[0]), &(t->heap[t->size - 1]), sizeof(entry_t));
siftdown(t, t->size, 0);
t->size--;
--
To view, visit https://gerrit.libreoffice.org/4202
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I20852eed68aaf956c8597442a986d37ff21e106a
Gerrit-PatchSet: 1
Gerrit-Project: libexttextcat
Gerrit-Branch: master
Gerrit-Owner: Mark Wielaard <mark@klomp.org>
Context
- [PATCH] Don't use overlapping memcpy in heapextract. · Mark Wielaard (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.