pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix List memory issue in transformColumnDefinition
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix List memory issue in transformColumnDefinition
@ 2023-03-30 23:13  David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: David Rowley @ 2023-03-30 23:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix List memory issue in transformColumnDefinition

When calling generateSerialExtraStmts(), we would pass in the
constraint->options.  In some cases, generateSerialExtraStmts() would
modify the referenced List to remove elements from it, but doing so is
invalid without assigning the list back to all variables that point to it.
In the particular reported problem case, the List became empty, in which
cases it became NIL, but the passed in constraint->options didn't get to
find out about that and was left pointing to free'd memory.

To fix this, just perform a list_copy() inside generateSerialExtraStmts().
We could just do a list_copy() just before we perform the delete from the
list, however, that seems less robust.  Let's make sure the generated
CreateSeqStmt gets a completely different copy of the list to be safe.

Bug: #17879
Reported-by: Fei Changhong
Diagnosed-by: Fei Changhong
Discussion: https://postgr.es/m/17879-b7dfb5debee58ff5@postgresql.org
Backpatch-through: 11, all supported versions

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6c3b697b19db6274da622cf0fe7a7ad32eeeced3

Modified Files
--------------
src/backend/parser/parse_utilcmd.c | 3 +++
1 file changed, 3 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix List memory issue in transformColumnDefinition
@ 2023-03-30 23:13  David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: David Rowley @ 2023-03-30 23:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix List memory issue in transformColumnDefinition

When calling generateSerialExtraStmts(), we would pass in the
constraint->options.  In some cases, generateSerialExtraStmts() would
modify the referenced List to remove elements from it, but doing so is
invalid without assigning the list back to all variables that point to it.
In the particular reported problem case, the List became empty, in which
cases it became NIL, but the passed in constraint->options didn't get to
find out about that and was left pointing to free'd memory.

To fix this, just perform a list_copy() inside generateSerialExtraStmts().
We could just do a list_copy() just before we perform the delete from the
list, however, that seems less robust.  Let's make sure the generated
CreateSeqStmt gets a completely different copy of the list to be safe.

Bug: #17879
Reported-by: Fei Changhong
Diagnosed-by: Fei Changhong
Discussion: https://postgr.es/m/17879-b7dfb5debee58ff5@postgresql.org
Backpatch-through: 11, all supported versions

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/df567fbf6e41aa6b574ead3803c304af55645501

Modified Files
--------------
src/backend/parser/parse_utilcmd.c | 3 +++
1 file changed, 3 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix List memory issue in transformColumnDefinition
@ 2023-03-30 23:14  David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: David Rowley @ 2023-03-30 23:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix List memory issue in transformColumnDefinition

When calling generateSerialExtraStmts(), we would pass in the
constraint->options.  In some cases, generateSerialExtraStmts() would
modify the referenced List to remove elements from it, but doing so is
invalid without assigning the list back to all variables that point to it.
In the particular reported problem case, the List became empty, in which
cases it became NIL, but the passed in constraint->options didn't get to
find out about that and was left pointing to free'd memory.

To fix this, just perform a list_copy() inside generateSerialExtraStmts().
We could just do a list_copy() just before we perform the delete from the
list, however, that seems less robust.  Let's make sure the generated
CreateSeqStmt gets a completely different copy of the list to be safe.

Bug: #17879
Reported-by: Fei Changhong
Diagnosed-by: Fei Changhong
Discussion: https://postgr.es/m/17879-b7dfb5debee58ff5@postgresql.org
Backpatch-through: 11, all supported versions

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2110162206b013e85c3c8caefb8f8913f32e9b6d

Modified Files
--------------
src/backend/parser/parse_utilcmd.c | 3 +++
1 file changed, 3 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix List memory issue in transformColumnDefinition
@ 2023-03-30 23:14  David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: David Rowley @ 2023-03-30 23:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix List memory issue in transformColumnDefinition

When calling generateSerialExtraStmts(), we would pass in the
constraint->options.  In some cases, generateSerialExtraStmts() would
modify the referenced List to remove elements from it, but doing so is
invalid without assigning the list back to all variables that point to it.
In the particular reported problem case, the List became empty, in which
cases it became NIL, but the passed in constraint->options didn't get to
find out about that and was left pointing to free'd memory.

To fix this, just perform a list_copy() inside generateSerialExtraStmts().
We could just do a list_copy() just before we perform the delete from the
list, however, that seems less robust.  Let's make sure the generated
CreateSeqStmt gets a completely different copy of the list to be safe.

Bug: #17879
Reported-by: Fei Changhong
Diagnosed-by: Fei Changhong
Discussion: https://postgr.es/m/17879-b7dfb5debee58ff5@postgresql.org
Backpatch-through: 11, all supported versions

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8d684c44511a5302a0f6c88feef51866a0f8f591

Modified Files
--------------
src/backend/parser/parse_utilcmd.c | 3 +++
1 file changed, 3 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix List memory issue in transformColumnDefinition
@ 2023-03-30 23:15  David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: David Rowley @ 2023-03-30 23:15 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix List memory issue in transformColumnDefinition

When calling generateSerialExtraStmts(), we would pass in the
constraint->options.  In some cases, generateSerialExtraStmts() would
modify the referenced List to remove elements from it, but doing so is
invalid without assigning the list back to all variables that point to it.
In the particular reported problem case, the List became empty, in which
cases it became NIL, but the passed in constraint->options didn't get to
find out about that and was left pointing to free'd memory.

To fix this, just perform a list_copy() inside generateSerialExtraStmts().
We could just do a list_copy() just before we perform the delete from the
list, however, that seems less robust.  Let's make sure the generated
CreateSeqStmt gets a completely different copy of the list to be safe.

Bug: #17879
Reported-by: Fei Changhong
Diagnosed-by: Fei Changhong
Discussion: https://postgr.es/m/17879-b7dfb5debee58ff5@postgresql.org
Backpatch-through: 11, all supported versions

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/33510bc64919b980433440340bc154e90af64e73

Modified Files
--------------
src/backend/parser/parse_utilcmd.c | 3 +++
1 file changed, 3 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix List memory issue in transformColumnDefinition
@ 2023-03-30 23:16  David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: David Rowley @ 2023-03-30 23:16 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix List memory issue in transformColumnDefinition

When calling generateSerialExtraStmts(), we would pass in the
constraint->options.  In some cases, generateSerialExtraStmts() would
modify the referenced List to remove elements from it, but doing so is
invalid without assigning the list back to all variables that point to it.
In the particular reported problem case, the List became empty, in which
cases it became NIL, but the passed in constraint->options didn't get to
find out about that and was left pointing to free'd memory.

To fix this, just perform a list_copy() inside generateSerialExtraStmts().
We could just do a list_copy() just before we perform the delete from the
list, however, that seems less robust.  Let's make sure the generated
CreateSeqStmt gets a completely different copy of the list to be safe.

Bug: #17879
Reported-by: Fei Changhong
Diagnosed-by: Fei Changhong
Discussion: https://postgr.es/m/17879-b7dfb5debee58ff5@postgresql.org
Backpatch-through: 11, all supported versions

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/07554c99dfdbba7809b73e8028cf8a9f5cbfa36f

Modified Files
--------------
src/backend/parser/parse_utilcmd.c | 3 +++
1 file changed, 3 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2023-03-30 23:16 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30 23:13 pgsql: Fix List memory issue in transformColumnDefinition David Rowley <drowley@postgresql.org>
2023-03-30 23:13 pgsql: Fix List memory issue in transformColumnDefinition David Rowley <drowley@postgresql.org>
2023-03-30 23:14 pgsql: Fix List memory issue in transformColumnDefinition David Rowley <drowley@postgresql.org>
2023-03-30 23:14 pgsql: Fix List memory issue in transformColumnDefinition David Rowley <drowley@postgresql.org>
2023-03-30 23:15 pgsql: Fix List memory issue in transformColumnDefinition David Rowley <drowley@postgresql.org>
2023-03-30 23:16 pgsql: Fix List memory issue in transformColumnDefinition David Rowley <drowley@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox