aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/copyfromparse.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-05-26 12:25:10 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-05-26 12:25:10 -0400
commit6217053f4e856159442629bd50c583ce3e4bc1fb (patch)
tree70480f8826ee8533f4ed744bfc1f445caa413d64 /src/backend/commands/copyfromparse.c
parentde89d8711e2b70150a2c5b3215d99da108fbe1e8 (diff)
downloadpostgresql-6217053f4e856159442629bd50c583ce3e4bc1fb.tar.gz
postgresql-6217053f4e856159442629bd50c583ce3e4bc1fb.zip
Avoid ERRCODE_INTERNAL_ERROR in oracle_compat.c functions.
repeat() checked for integer overflow during its calculation of the required output space, but it just passed the resulting integer to palloc(). This meant that result sizes between 1GB and 2GB led to ERRCODE_INTERNAL_ERROR, "invalid memory alloc request size" rather than ERRCODE_PROGRAM_LIMIT_EXCEEDED, "requested length too large". That seems like a bit of a wart, so add an explicit AllocSizeIsValid check to make these error cases uniform. Do likewise in the sibling functions lpad() etc. While we're here, also modernize their overflow checks to use pg_mul_s32_overflow() etc instead of expensive divisions. Per complaint from Japin Li. This is basically cosmetic, so I don't feel a need to back-patch. Discussion: https://postgr.es/m/ME3P282MB16676ED32167189CB0462173B6D69@ME3P282MB1667.AUSP282.PROD.OUTLOOK.COM
Diffstat (limited to 'src/backend/commands/copyfromparse.c')
0 files changed, 0 insertions, 0 deletions