Re: unrecognized node type while displaying a Path due to dangling pointer - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: unrecognized node type while displaying a Path due to dangling pointer
Date
Msg-id 20230711074911.n422h7vrclf74v6w@alvherre.pgsql
Whole thread Raw
In response to unrecognized node type while displaying a Path due to dangling pointer  (Jeevan Chalke <jeevan.chalke@enterprisedb.com>)
Responses Re: unrecognized node type while displaying a Path due to dangling pointer
List pgsql-hackers
On 2023-Jul-11, Jeevan Chalke wrote:

> 4. However, 2nd path was already sorted and passed as is to the add_path().
> 5. add_path() decides to reject this new path on some metrics. However, in
> the end, it pfree() this passed in path. It seems wrong as its references
> do present elsewhere. For example, in the first path's parent rels path
> list.
> 6. So, while displaying the parent's path, we end up with these warnings.

In other words, this is use-after-free, with add_path freeing the
passed-in Path pointer, but one particular case in which this Path is
still used afterwards.

> I tried to get a fix for this but no luck so far.

I proposed to add an add_path_extended() function that adds 'bool
free_input_path' argument, and pass it false in that one place in
create_ordered_paths.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/



pgsql-hackers by date:

Previous
From: "Wen Yi"
Date:
Subject: [PATCH]Add a tip to the check mode
Next
From: Masahiko Sawada
Date:
Subject: Re: logicalrep_message_type throws an error