libexttextcat: fix overlapping memcpy

Change-Id: I3225043560a3c0e02345bc4e8a8d0f9cca2e3cd0
This commit is contained in:
Michael Stahl
2013-07-04 23:12:53 +02:00
parent b832a7a78a
commit 3bde0af3a8
2 changed files with 17 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,exttextcat,$(LIBEXTTEXTCAT_TARBALL)
$(eval $(call gb_UnpackedTarball_add_patches,exttextcat,\
libexttextcat/android.patch \
libexttextcat/exttextcat-memcpy.patch.1 \
))
# vim: set noet sw=4 ts=4:

View File

@@ -0,0 +1,16 @@
fix overlapped memcpy in heapextract
--- a/src/fingerprint.c 2013-07-04 22:53:25.674741538 +0200
+++ b/src/fingerprint.c 2013-07-04 22:54:09.009741166 +0200
@@ -254,7 +254,10 @@
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--;