diff options
Diffstat (limited to 'meta/recipes-devtools/rpm/rpm/debugedit-segv.patch')
-rw-r--r-- | meta/recipes-devtools/rpm/rpm/debugedit-segv.patch | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/debugedit-segv.patch b/meta/recipes-devtools/rpm/rpm/debugedit-segv.patch index beef5edd9d..585cf12fd8 100644 --- a/meta/recipes-devtools/rpm/rpm/debugedit-segv.patch +++ b/meta/recipes-devtools/rpm/rpm/debugedit-segv.patch | |||
@@ -15,34 +15,36 @@ Upstream-Status: Pending | |||
15 | 15 | ||
16 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | 16 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> |
17 | 17 | ||
18 | Index: rpm-5.4.14/tools/debugedit.c | 18 | Index: rpm/tools/debugedit.c |
19 | =================================================================== | 19 | =================================================================== |
20 | --- rpm-5.4.14.orig/tools/debugedit.c | 20 | --- rpm.orig/tools/debugedit.c |
21 | +++ rpm-5.4.14/tools/debugedit.c | 21 | +++ rpm/tools/debugedit.c |
22 | @@ -1445,21 +1445,24 @@ handle_build_id (DSO *dso, Elf_Data *bui | 22 | @@ -1403,7 +1403,8 @@ static inline void process (hashFunction |
23 | auto inline void process (const void *data, size_t size) | 23 | const void *data, size_t size) |
24 | { | 24 | { |
25 | memchunk chunk = { .data = (void *) data, .size = size }; | 25 | memchunk chunk = { .data = (void *) data, .size = size }; |
26 | - hashFunctionContextUpdateMC (&ctx, &chunk); | 26 | - hashFunctionContextUpdateMC (ctx, &chunk); |
27 | + if (data != NULL && size != 0) | 27 | + if (data != NULL && size != 0) |
28 | + hashFunctionContextUpdateMC (&ctx, &chunk); | 28 | + hashFunctionContextUpdateMC (ctx, &chunk); |
29 | } | 29 | } |
30 | union | 30 | |
31 | { | 31 | /* Compute a fresh build ID bit-string from the editted file contents. */ |
32 | @@ -1456,14 +1457,16 @@ handle_build_id (DSO *dso, Elf_Data *bui | ||
32 | GElf_Ehdr ehdr; | 33 | GElf_Ehdr ehdr; |
33 | GElf_Phdr phdr; | 34 | GElf_Phdr phdr; |
34 | GElf_Shdr shdr; | 35 | GElf_Shdr shdr; |
35 | - } u; | 36 | - } u; |
36 | - Elf_Data x = { .d_version = EV_CURRENT, .d_buf = &u }; | 37 | - Elf_Data x = { .d_version = EV_CURRENT, .d_buf = &u }; |
37 | + } u1, u2; | 38 | - |
38 | + Elf_Data src = { .d_version = EV_CURRENT, .d_buf = &u1 }; | ||
39 | + Elf_Data dest = { .d_version = EV_CURRENT, .d_buf = &u2 }; | ||
40 | |||
41 | - x.d_type = ELF_T_EHDR; | 39 | - x.d_type = ELF_T_EHDR; |
42 | - x.d_size = sizeof u.ehdr; | 40 | - x.d_size = sizeof u.ehdr; |
43 | - u.ehdr = dso->ehdr; | 41 | - u.ehdr = dso->ehdr; |
44 | - u.ehdr.e_phoff = u.ehdr.e_shoff = 0; | 42 | - u.ehdr.e_phoff = u.ehdr.e_shoff = 0; |
45 | - if (elf64_xlatetom (&x, &x, dso->ehdr.e_ident[EI_DATA]) == NULL) | 43 | - if (elf64_xlatetom (&x, &x, dso->ehdr.e_ident[EI_DATA]) == NULL) |
44 | + } u1, u2; | ||
45 | + Elf_Data src = { .d_version = EV_CURRENT, .d_buf = &u1 }; | ||
46 | + Elf_Data dest = { .d_version = EV_CURRENT, .d_buf = &u2 }; | ||
47 | + | ||
46 | + src.d_type = ELF_T_EHDR; | 48 | + src.d_type = ELF_T_EHDR; |
47 | + src.d_size = sizeof u1.ehdr; | 49 | + src.d_size = sizeof u1.ehdr; |
48 | + dest.d_size = sizeof u2.ehdr; | 50 | + dest.d_size = sizeof u2.ehdr; |
@@ -52,7 +54,7 @@ Index: rpm-5.4.14/tools/debugedit.c | |||
52 | { | 54 | { |
53 | bad: | 55 | bad: |
54 | fprintf (stderr, "Failed to compute header checksum: %s\n", | 56 | fprintf (stderr, "Failed to compute header checksum: %s\n", |
55 | @@ -1467,29 +1470,31 @@ handle_build_id (DSO *dso, Elf_Data *bui | 57 | @@ -1471,29 +1474,31 @@ handle_build_id (DSO *dso, Elf_Data *bui |
56 | exit (1); | 58 | exit (1); |
57 | } | 59 | } |
58 | 60 | ||
@@ -69,8 +71,8 @@ Index: rpm-5.4.14/tools/debugedit.c | |||
69 | - if (elf64_xlatetom (&x, &x, dso->ehdr.e_ident[EI_DATA]) == NULL) | 71 | - if (elf64_xlatetom (&x, &x, dso->ehdr.e_ident[EI_DATA]) == NULL) |
70 | + if (elf64_xlatetom (&dest, &src, dso->ehdr.e_ident[EI_DATA]) == NULL) | 72 | + if (elf64_xlatetom (&dest, &src, dso->ehdr.e_ident[EI_DATA]) == NULL) |
71 | goto bad; | 73 | goto bad; |
72 | - process (x.d_buf, x.d_size); | 74 | - process (&ctx, x.d_buf, x.d_size); |
73 | + process (dest.d_buf, dest.d_size); | 75 | + process (&ctx, dest.d_buf, dest.d_size); |
74 | } | 76 | } |
75 | 77 | ||
76 | - x.d_type = ELF_T_SHDR; | 78 | - x.d_type = ELF_T_SHDR; |
@@ -88,8 +90,8 @@ Index: rpm-5.4.14/tools/debugedit.c | |||
88 | + u1.shdr.sh_offset = 0; | 90 | + u1.shdr.sh_offset = 0; |
89 | + if (elf64_xlatetom (&dest, &src, dso->ehdr.e_ident[EI_DATA]) == NULL) | 91 | + if (elf64_xlatetom (&dest, &src, dso->ehdr.e_ident[EI_DATA]) == NULL) |
90 | goto bad; | 92 | goto bad; |
91 | - process (x.d_buf, x.d_size); | 93 | - process (&ctx, x.d_buf, x.d_size); |
92 | + process (dest.d_buf, dest.d_size); | 94 | + process (&ctx, dest.d_buf, dest.d_size); |
93 | 95 | ||
94 | - if (u.shdr.sh_type != SHT_NOBITS) | 96 | - if (u.shdr.sh_type != SHT_NOBITS) |
95 | + if (u1.shdr.sh_type != SHT_NOBITS) | 97 | + if (u1.shdr.sh_type != SHT_NOBITS) |