Skip to content

libbacktrace bundled twice, one copy is missing bugfixes #43449

@infinity0

Description

@infinity0

From the 1.19 tarball:

$ diff -ruw src/vendor/backtrace-sys/src/libbacktrace/ src/libbacktrace/ | wc -l
553

Includes this:

diff -ru -ruw src/vendor/backtrace-sys/src/libbacktrace/pecoff.c src/libbacktrace/pecoff.c
--- src/vendor/backtrace-sys/src/libbacktrace/pecoff.c	2017-07-24 10:44:52.283085695 +0200
+++ src/libbacktrace/pecoff.c	2017-04-19 22:41:07.723729879 +0200
@@ -602,9 +602,14 @@
   const b_coff_section_header *sects;
   struct backtrace_view str_view;
   int str_view_valid;
-  size_t str_size;
+  // NOTE: upstream this is a `size_t` but this was fixed in Rust commit
+  //       55e2b7e1b, see #33729 for more info. If you see this in a diff
+  //       against the upstream libbacktrace, that's what's going on.
+  uint32_t str_size;
   off_t str_off;
-  struct backtrace_view syms_view;
+  // NOTE: upstream doesn't have `{0}`, this is a fix for Rust issue #39468.
+  //       If syms_view is not initialized, then `free(syms_view.base)` may segfault later.
+  struct backtrace_view syms_view = {0};
   off_t syms_off;
   size_t syms_size;
   int syms_view_valid;

src/libbacktrace is only mentioned explicitly by rustbuild once in src/bootstrap/dist.rs to build a source tarball, so I guess it's not used at all. That means the bugfixes are actually missing from rustc entirely.

More generally, I think it's worth auditing source tarballs to avoid duplicating C code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-infraRelevant to the infrastructure team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions