From patchwork Mon Jun 17 14:41:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Terekhov, Mikhail via Gdb-patches" X-Patchwork-Id: 33162 Received: (qmail 100403 invoked by alias); 17 Jun 2019 14:42:01 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 100394 invoked by uid 89); 17 Jun 2019 14:42:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.5 required=5.0 tests=AWL, BAYES_00, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS, USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy=HX-Received:144 X-HELO: mail-vk1-f170.google.com Received: from mail-vk1-f170.google.com (HELO mail-vk1-f170.google.com) (209.85.221.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Jun 2019 14:42:00 +0000 Received: by mail-vk1-f170.google.com with SMTP id b69so2113563vkb.3 for ; Mon, 17 Jun 2019 07:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Cs+f8CBurveVVjjRhButNq3zyre05qWcqh8WyTFMN0w=; b=SM3lhtC/0oWpXqMZIRlJt6RNPiUGlepqD1IPyU9O3h2l7Fpr0ynrlKZ1g+wl2pbc90 UAWEQv35qegA82pOyZAKMrxqF7LhU7wYO4p3als3pcyIR+ps/gLRV2X5WcrUwiNaT6dv HV9t12p01wTmgpQCAGIap8amXgQZrdQEA13e+S71Ik5KDcurpVL0paTX4j76x7bWHTVt vh9LC9nMuJCkOuLO5+PGyWIOxwYx9gN4X+ff5wBrEkamzkUsUvk2Vds6J2+gLZcKpbpm ilEhqicMOAmxy5yhYoGhNWbwtbATX9oHwW33zbPVJGJ8TP/vCIaZXj1fty8v2tw9QKi1 CKTg== MIME-Version: 1.0 X-Patchwork-Original-From: "Paul Pluzhnikov via gdb-patches" From: "Terekhov, Mikhail via Gdb-patches" Reply-To: Paul Pluzhnikov Date: Mon, 17 Jun 2019 07:41:30 -0700 Message-ID: Subject: [patch][gdb] Fix crashes in bz24364 To: gdb-patches ml X-IsSubscribed: yes This is somewhat on the obvious side. Fix all crashes from bz24364. gdb/ChangeLog PR gdb/24364 * gdb/dtrace-probe.c (dtrace_static_probe_ops::get_probe): Don't call dtrace_process_dof with NULL dof. diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c index 52973784e9..2a2eae1f70 100644 --- a/gdb/dtrace-probe.c +++ b/gdb/dtrace-probe.c @@ -856,13 +856,14 @@ dtrace_static_probe_ops::get_probes /* Read the contents of the DOF section and then process it to extract the information of any probe defined into it. */ - if (!bfd_malloc_and_get_section (abfd, sect, &dof)) + if (bfd_malloc_and_get_section (abfd, sect, &dof) && dof != NULL) + dtrace_process_dof (sect, objfile, probesp, + (struct dtrace_dof_hdr *) dof); + else complaint (_("could not obtain the contents of" "section '%s' in objfile `%s'."), sect->name, abfd->filename); - - dtrace_process_dof (sect, objfile, probesp, - (struct dtrace_dof_hdr *) dof); + xfree (dof); } }