BUG #18853: integer may overflow in array_user_functions

PG Bug reporting form <noreply@postgresql.org>

From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: ma100@hotmail.com
Date: 2025-03-18T08:02:46Z
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18853
Logged by:          ma liangzhu
Email address:      ma100@hotmail.com
PostgreSQL version: 17.0
Operating system:   centos
Description:        

I noticed that in the array_userfunc.c file, there are many calculations
involving int32 without overflow checks. 

For example: 

int reqsize = state1->nbytes + state2->nbytes; 

This could potentially cause overflow, leading to issues.