Dec 2024

1 commit
Fix various overflow hazards in date and timestamp functions.
9 Dec 2024Nathan Bossartmaster18beta1REL_19_STABLE18beta1REL_18_STABLE18beta1Also in: BUG #18585: Date/time conversion functions are not protected against integer overflow (not this thread)
LLM analysis, 99% suremodified before commitmoderate changesfrom patchset #830 of 2 reviewers saw the final version

Matches #83 across all eight files, with a changed Y,YYY error code and removal of temporary variables in two week calculations in formatting.c. The commit credits Matthew Kim and Nathan Bossart; #84 describes subsequent staging and #85 confirms the landing without backpatches.

  • Joseph Koshakowsaw an earlier versiontrailerJoseph checked the make_date() behavior in #51 and approved #80 in #81, before additional overflow cases and the Windows fix were added.
  • Jian Hesaw an earlier versiontrailerJian questioned the make_date() error in #50 and approved it in #53, before the broader date/time changes.

Aug 2024

3 commits
Further reduce dependence on -fwrapv semantics in jsonb.
16 Aug 2024Nathan Bossartmaster18beta1REL_19_STABLE18beta1REL_18_STABLE18beta1
LLM analysis, 100% surewritten from the discussion, no matching patch1 of 1 reviewer saw the final version

Implements Nathan's inline jsonb_array_element_text() fix from #69 and applies the same pg_abs_s32() substitution in jsonb_delete_idx(). Alexander's failing -ftrapv test in #68 prompted the follow-up, whose landing is confirmed in #71.

  • Alexander Lakhinsaw the final versionLLM analysis, 97% sureTesting the preceding JSONB landing with -ftrapv, Alexander reported the missed jsonb_array_element_text() overflow in #68, directly prompting this inline follow-up.
Remove dependence on -fwrapv semantics in jsonb.
16 Aug 2024Nathan Bossartmaster18beta1REL_19_STABLE18beta1REL_18_STABLE18beta1
LLM analysis, 100% suremodified before commitlight changesfrom patchset #651 of 2 reviewers saw the final version

The jsonfuncs.c changes match #65; the commit relocates the delete-path test and adds a text-extraction regression test. The attached patch and commit both credit Joseph, although Nathan sent the source submission.

  • Jian Hesaw an earlier versiontrailerJian proposed consistent PG_INT32_MIN usage in #41, before Nathan replaced the explicit guards with pg_abs_s32() in #65.
  • Nathan Bossartsaw the final versioncommittercommitted the patch
Remove dependence on -fwrapv semantics in a few places.
15 Aug 2024Nathan Bossartmaster18beta1REL_19_STABLE18beta1REL_18_STABLE18beta1
LLM analysis, 100% suremodified before commitmoderate changesfrom patchset #592 of 4 reviewers saw the final version

Matches #59 except for Heikki's rewritten common/int.h documentation and the uint128-to-int128 correction in pg_neg_u64_overflow() identified in #62. The patch header and commit credit Joseph.

  • Tom Lanesaw an earlier versiontrailerTom analyzed the timestamp overflow checks and requested an epoch-boundary test in #3 and #5, before substantial helper revisions.
  • Heikki Linnakangassaw an earlier versiontrailerHeikki approved the helper approach and improved its explanation in #56 and #60, before the functional signedness correction reported in #62.
  • Jian Hesaw the final versiontrailerJian identified the incorrect uint128 intermediate in #62, and Nathan confirmed and applied that correction before committing.
  • Nathan Bossartsaw the final versioncommittercommitted the patch

Jul 2024

2 commits
Detect integer overflow in array_set_slice().
24 Jul 2024Nathan Bossartmaster18beta1REL_19_STABLE18beta1REL_18_STABLE18beta1REL_17_STABLE17beta3REL_16_STABLE16.4REL_15_STABLE15.8REL_14_STABLE14.13REL_13_STABLE13.16+1 more
LLM analysis, 100% surepart of a posted patchsetlight changesfrom patchset #422 of 2 reviewers saw the final version

Lands only the array component of #42, preserving its checked subtraction/addition implementation in arrayfuncs.c. Nathan relocates and trims the tests to use SQLSTATE-only errors because MaxArraySize is platform-dependent, as explained in #43.

  • Jian Hesaw the final versiontrailerJian reported changed array-bound error behavior in #30 and agreed with the subtraction-first solution in #41, after which only tests changed.
  • Nathan Bossartsaw the final versioncommittercommitted the patch
Add overflow checks to money type.
19 Jul 2024Nathan Bossartmaster18beta1REL_19_STABLE18beta1REL_18_STABLE18beta1REL_17_STABLE17beta3REL_16_STABLE16.4REL_15_STABLE15.8REL_14_STABLE14.13REL_13_STABLE13.16+1 moreAlso in: BUG #18240: Undefined behaviour in cash_mul_flt8() and friends (written from the discussion, no matching patch)
LLM analysis, 100% surepart of a posted patchsetlight changesfrom patchset #311 of 1 reviewer saw the final version

Lands only the money component of #31: src/backend/utils/adt/cash.c matches modulo rebase context, while the regression tests are reduced and a division-by-zero case is added. I disagree with the from_discussion attribution in thread #72257: that thread supplied the bug report and lists only a January attachment, whereas this thread supplies the matching July patchset and confirms its landing in #32.

  • Nathan Bossartsaw the final versioncommittercommitted the patch

Credits across 6 commits

Author
Joseph Koshakow4
Matthew Kim1
Nathan Bossart1
Reviewer
jian he4
Nathan Bossartcommitter4
Heikki Linnakangas1
Joseph Koshakow1
Tom Lane1
Reported by
Alexander Lakhin5
Committer
Nathan Bossart6