xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-devtools/binutils/binutils/0016-CVE-2022-38126.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From e3e5ae049371a27fd1737aba946fe26d06e029b5 Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Mon, 27 Jun 2022 13:43:02 +0100
4Subject: [PATCH] Replace a run-time assertion failure with a warning message
5 when parsing corrupt DWARF data.
6
7	PR 29289
8	* dwarf.c (display_debug_names): Replace assert with a warning
9	message.
10
11Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e3e5ae049371a27fd1737aba946fe26d06e029b5]
12
13Signed-off-by: Pgowda <pgowda.cve@gmail.com>
14---
15 binutils/dwarf.c   | 7 ++++++-
16
17diff --git a/binutils/dwarf.c b/binutils/dwarf.c
18index 37b477b886d..b99c56987da 100644
19--- a/binutils/dwarf.c
20+++ b/binutils/dwarf.c
21@@ -9802,7 +9802,12 @@ display_debug_names (struct dwarf_sectio
22       printf (_("Out of %lu items there are %zu bucket clashes"
23 		" (longest of %zu entries).\n"),
24 	      (unsigned long) name_count, hash_clash_count, longest_clash);
25-      assert (name_count == buckets_filled + hash_clash_count);
26+
27+      if (name_count != buckets_filled + hash_clash_count)
28+	warn (_("The name_count (%lu) is not the same as the used bucket_count (%lu) + the hash clash count (%lu)"),
29+	      (unsigned long) name_count,
30+	      (unsigned long) buckets_filled,
31+	      (unsigned long) hash_clash_count);
32
33       struct abbrev_lookup_entry
34       {
35