- Fix an occasional crash during printing of missing debuginfo rpms (BZ

505401).
This commit is contained in:
Jan Kratochvil 2009-06-13 08:54:50 +00:00
parent 329bfe12ba
commit 743d2ee5f1
2 changed files with 29 additions and 18 deletions

View File

@ -786,7 +786,7 @@
if (retval != NULL && !build_id_verify (retval, build_id))
{
@@ -1314,9 +1714,424 @@ build_id_to_debug_filename (struct build
@@ -1314,9 +1714,432 @@ build_id_to_debug_filename (struct build
retval = NULL;
}
@ -1103,8 +1103,8 @@
+ const struct missing_filepair *elem2)
+{
+ return strcmp (elem1->binary, elem2->binary) == 0
+ && ((elem1->debug == NULL && elem2->debug == NULL)
+ || strcmp (elem1->debug, elem2->debug) == 0);
+ && ((elem1->debug == NULL) == (elem2->debug == NULL))
+ && (elem1->debug == NULL || strcmp (elem1->debug, elem2->debug) == 0);
+}
+
+static void
@ -1137,6 +1137,7 @@
+{
+ size_t binary_len0 = strlen (binary) + 1;
+ size_t debug_len0 = debug ? strlen (debug) + 1 : 0;
+ struct missing_filepair missing_filepair_find;
+ struct missing_filepair *missing_filepair;
+ struct missing_filepair **slot;
+
@ -1152,6 +1153,27 @@
+ missing_filepair_xcalloc, NULL);
+ }
+
+ /* Use MISSING_FILEPAIR_FIND first instead of calling obstack_alloc with
+ obstack_free in the case of a (rare) match. The problem is ALLOC_F for
+ MISSING_FILEPAIR_HASH allocates from MISSING_FILEPAIR_OBSTACK maintenance
+ structures for MISSING_FILEPAIR_HASH. Calling obstack_free would possibly
+ not to free only MISSING_FILEPAIR but also some such structures (allocated
+ during the htab_find_slot call). */
+
+ missing_filepair_find.binary = (char *) binary;
+ missing_filepair_find.debug = (char *) debug;
+ slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash,
+ &missing_filepair_find,
+ INSERT);
+
+ /* While it may be still printed duplicitely with the missing debuginfo file
+ * it is due to once printing about the binary file build-id link and once
+ * about the .debug file build-id link as both the build-id symlinks are
+ * located in the debuginfo package. */
+
+ if (*slot != NULL)
+ return;
+
+ missing_filepair = obstack_alloc (&missing_filepair_obstack,
+ sizeof (*missing_filepair) - 1
+ + binary_len0 + debug_len0);
@ -1165,20 +1187,6 @@
+ else
+ missing_filepair->debug = NULL;
+
+ slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash,
+ missing_filepair,
+ INSERT);
+
+ /* While it may be still printed duplicitely with the missing debuginfo file
+ * it is due to once printing about the binary file build-id link and once
+ * about the .debug file build-id link as both the build-id symlinks are
+ * located in the debuginfo package. */
+
+ if (*slot != NULL)
+ {
+ obstack_free (&missing_filepair_obstack, missing_filepair);
+ return;
+ }
+ *slot = missing_filepair;
+
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)

View File

@ -13,7 +13,7 @@ Version: 6.8
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 30%{?_with_upstream:.upstream}%{?dist}
Release: 31%{?_with_upstream:.upstream}%{?dist}
License: GPLv3+
Group: Development/Debuggers
@ -896,6 +896,9 @@ fi
%endif
%changelog
* Sat Jun 13 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-31
- Fix an occasional crash during printing of missing debuginfo rpms (BZ 505401).
* Thu Jun 11 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-30
- Fix dereferencing unbound C arrays (BZ 505163).