This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] GOLD/DWP: avoid segmentation fault for binaries without debug fission
- From: Sriraman Tallam <tmsriram at google dot com>
- To: Yunlian Jiang <yunlian at google dot com>
- Cc: binutils <binutils at sourceware dot org>, Cary Coutant <ccoutant at gmail dot com>
- Date: Tue, 17 May 2016 10:02:30 -0700
- Subject: Re: [PATCH] GOLD/DWP: avoid segmentation fault for binaries without debug fission
- Authentication-results: sourceware.org; auth=none
- References: <CAMsPy2uPy1NcZxF_a03izT_xz4YBkJo=ECcMmXp_2sa7MMqzhQ at mail dot gmail dot com>
On Mon, May 16, 2016 at 4:56 PM, Yunlian Jiang <yunlian@google.com> wrote:
> If run dwp command on a binary built without debug fission, it will
> cause segmentation
> fault. This patch fixes that by exit early if no DWO files information
> found inside the
> input binary.
>
> gold/
> * dwp.cc: (main): exit early when no DWO files information found
> in the input binary.
>
> diff --git a/gold/dwp.cc b/gold/dwp.cc
> index d8c39c6..c26f969 100644
> --- a/gold/dwp.cc
> +++ b/gold/dwp.cc
> @@ -2436,6 +2436,11 @@ main(int argc, char** argv)
> return ok ? EXIT_SUCCESS : EXIT_FAILURE;
> }
>
> + // If there is no DWO files information found in the input binary,
> + // return early to avoid segmentation fault.
Change the comment to maybe "If there are no DWO files, there is
nothing to do."
> + if (files.size() == 0)
> + return EXIT_SUCCESS;
> +
This looks fine to me but I do not have permissions to approve.
Thanks
Sri
> // Process each file, adding its contents to the output file.
> Dwp_output_file output_file(output_filename.c_str());
> for (File_list::const_iterator f = files.begin(); f != files.end(); ++f)