Fixed with the attached patch.
On Sun, May 19, 2024 at 10:26 PM James Youngman <invalid.nore...@gnu.org> wrote: > Update of bug #63605 (group findutils): > > Status: None => Fixed > > Assigned to: None => jay > > > _______________________________________________________ > > Follow-up Comment #1: > > This problem is fixed in the git code for findutils. > To resolve your problem, you could either wait for the > next official release of findutils, or check out a copy > of the code from the git repository for findutils. > > See https://savannah.gnu.org/git/?group=findutils > > > > _______________________________________________________ > > Reply to this item at: > > <https://savannah.gnu.org/bugs/?63605> > > _______________________________________________ > Message sent via Savannah > https://savannah.gnu.org/ > >
From 9874c773f2f15ef81c7d95eb0b08f0245acd87b3 Mon Sep 17 00:00:00 2001 From: James Youngman <ja...@youngman.org> Date: Sun, 19 May 2024 22:23:19 +0100 Subject: [PATCH] [find] avoid undefined behaviour in consider_arm_swap. To: findutils-patc...@gnu.org This fixes Savannah bug #63605. * find/tree.c: avoid invalid struct member access in consider_arm_swap --- find/tree.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/find/tree.c b/find/tree.c index 1c6b4588..c42eb9e0 100644 --- a/find/tree.c +++ b/find/tree.c @@ -529,7 +529,7 @@ consider_arm_swap (struct predicate *p) { int left_cost, right_cost; const char *reason = NULL; - struct predicate **pl, **pr; + struct predicate **pl = NULL, **pr = NULL; if (BI_OP != p->p_type) reason = "Not a binary operation"; @@ -540,14 +540,18 @@ consider_arm_swap (struct predicate *p) reason = "Doesn't have two arms"; } - if (!reason) { if (NULL == p->pred_left->pred_right) - reason = "Left arm has no child on RHS"; + { + reason = "Left arm has no child on RHS"; + } + else + { + pr = &p->pred_right; + pl = &p->pred_left->pred_right; + } } - pr = &p->pred_right; - pl = &p->pred_left->pred_right; if (!reason) { -- 2.39.2