9. PostgreSQL Server 15.2 Subprocess Went down at function 'expanded_record_set_fields'

From: <fjz22(at)mails(dot)tsinghua(dot)edu(dot)cn>
To: <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Cc: <ljiee(at)mail(dot)tsinghua(dot)edu(dot)cn>, <wuzy21(at)mails(dot)tsinghua(dot)edu(dot)cn>
Subject: 9. PostgreSQL Server 15.2 Subprocess Went down at function 'expanded_record_set_fields'
Date: 2023-04-13 16:47:15
Message-ID: 00dd01d96e27$9a8ca9f0$cfa5fdd0$@mails.tsinghua.edu.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Description: PostgreSQL Server 15.2 Subprocess Went down at function
'expanded_record_set_fields'

PostgreSQL Server Version: PostgreSQL 15.2 on x86_64-pc-linux-gnu, compiled
by Ubuntu clang version 12.0.1, 64-bit

Discoverer: Jingzhou Fu, Jie Liang and Zhiyong Wu in WingTecher Lab of
Tsinghua University and Shuimuyulin ltd

Email address: fjz22(at)mails(dot)tsinghua(dot)edu(dot)cn , wuzy21(at)mails(dot)tsinghua(dot)edu(dot)cn
, ljiee(at)mail(dot)tsinghua(dot)edu(dot)cn

Way to Reproduce with Docker (write the poc content into file PoC.sql):

```bash

docker container rm some-postgres -f

docker run --name some-postgres -p 5432:5432 -e
POSTGRES_PASSWORD=mysecretpassword -d postgres:15.2

sleep 5 # wait the server start .

docker exec -i some-postgres psql --user=postgres < PoC.sql

# Output:

# server closed the connection unexpectedly

# This probably means the server terminated abnormally

# before or while processing the request.

# connection to server was lost

```

PoC:

```sql

CREATE FUNCTION command(cstring)

RETURNS test_extdep_commands

AS 'int4in'

LANGUAGE internal STRICT IMMUTABLE;

CREATE FUNCTION inet_tbl(test_extdep_commands)

RETURNS cstring

AS 'int4out'

LANGUAGE internal STRICT IMMUTABLE;

CREATE TYPE test_extdep_commands (

internallength = variable,

input = command,

output = inet_tbl,

alignment = int4,

default = 'zippo'

);

CREATE TYPE inet_idx3 AS (f1 test_extdep_commands, f2 test_extdep_commands);

CREATE FUNCTION _return(x int, y int, z int)

RETURNS inet_idx3 AS $$

declare v inet_idx3 := row(x, y);

begin

v.test_pg_dump_t1 := z;

return v;

end

$$ LANGUAGE plpgsql;

SELECT * FROM _return(1,2,0);

```

Backtrace:

```

#0 0x18480e0 (expanded_record_set_fields+0x4a0)

#1 0x7f2a94004ae8 (exec_move_row_from_fields+0xe48)

#2 0x7f2a93fd703c (exec_move_row+0x7fc)

#3 0x7f2a93fd6730 (exec_move_row_from_datum+0x17b0)

#4 0x7f2a93fdf4e5 (exec_assign_value+0xed5)

#5 0x7f2a93fe0178 (exec_assign_expr+0x408)

#6 0x7f2a93fdcaf8 (exec_stmt_block+0x708)

#7 0x7f2a93fd7574 (exec_toplevel_block+0x234)

#8 0x7f2a93fd1023 (plpgsql_exec_function+0x11f3)

#9 0x7f2a9403481f (plpgsql_call_handler+0x86f)

#10 0xee3b21 (ExecMakeTableFunctionResult+0xf31)

#11 0xf47d9d (FunctionNext+0x37d)

#12 0xee8cd0 (ExecScanFetch+0x7d0)

#13 0xee8207 (ExecScan+0x107)

#14 0xf46b91 (ExecFunctionScan+0x31)

#15 0xedbf36 (ExecProcNodeFirst+0x116)

#16 0xec0e2c (ExecProcNode+0x7c)

#17 0xeb3a9f (ExecutePlan+0x1df)

#18 0xeb3780 (standard_ExecutorRun+0x550)

#19 0xeb3224 (ExecutorRun+0x64)

#20 0x16f6361 (PortalRunSelect+0x241)

#21 0x16f53bd (PortalRun+0x7ed)

#22 0x16e9694 (exec_simple_query+0xe04)

#23 0x16e7a63 (PostgresMain+0x1523)

#24 0x144c17b (BackendRun+0xbb)

#25 0x144ad85 (BackendStartup+0x525)

#26 0x14481e6 (ServerLoop+0x616)

#27 0x1443e0f (PostmasterMain+0x30cf)

#28 0x106ebf2 (main+0x5a2)

#29 0x7f2a9ff94083 (__libc_start_main+0xf3)

#30 0x49fc0e (_start+0x2e)

```

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2023-04-14 03:00:20 Re: BUG #17895: Bug concerning UTF-8
Previous Message fjz22 2023-04-13 16:45:43 8. PostgreSQL Server 15.2 Subprocess Went down at function 'pg_detoast_datum_copy'