summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/elfutils/elfutils/Fix_elf_cvt_gunhash.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/elfutils/elfutils/Fix_elf_cvt_gunhash.patch')
-rw-r--r--meta/recipes-devtools/elfutils/elfutils/Fix_elf_cvt_gunhash.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils/Fix_elf_cvt_gunhash.patch b/meta/recipes-devtools/elfutils/elfutils/Fix_elf_cvt_gunhash.patch
new file mode 100644
index 0000000000..5a98f6b9d0
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils/Fix_elf_cvt_gunhash.patch
@@ -0,0 +1,29 @@
1Fix elf_cvt_gunhash if dest and src are same.
2
3Upstream-status: Pending
4
5The 'dest' and 'src' can be same, we need to save the value of src32[2]
6before swaping it.
7
8Signed-off-by: Baoshan Pang <BaoShan.Pang@windriver.com>
9diff --git a/libelf/gnuhash_xlate.h b/libelf/gnuhash_xlate.h
10index 6faf113..04d9ca1 100644
11--- a/libelf/gnuhash_xlate.h
12+++ b/libelf/gnuhash_xlate.h
13@@ -40,6 +40,7 @@ elf_cvt_gnuhash (void *dest, const void *src, size_t len, int encode)
14 words. We must detangle them here. */
15 Elf32_Word *dest32 = dest;
16 const Elf32_Word *src32 = src;
17+ Elf32_Word save_src32_2 = src32[2]; // dest could be equal to src
18
19 /* First four control words, 32 bits. */
20 for (unsigned int cnt = 0; cnt < 4; ++cnt)
21@@ -50,7 +51,7 @@ elf_cvt_gnuhash (void *dest, const void *src, size_t len, int encode)
22 len -= 4;
23 }
24
25- Elf32_Word bitmask_words = encode ? src32[2] : dest32[2];
26+ Elf32_Word bitmask_words = encode ? save_src32_2 : dest32[2];
27
28 /* Now the 64 bit words. */
29 Elf64_Xword *dest64 = (Elf64_Xword *) &dest32[4];