aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2019-11-30 14:51:27 +0100
committerTomas Vondra <tomas.vondra@postgresql.org>2019-11-30 15:04:02 +0100
commit0dafed6fedf4da0e0e38c5961ae4b1540b4a8a5c (patch)
tree73a42dfe8ec38a0e752a2ace735decb265aa6e2e /src/backend/access/gist
parent79d6e6afabcb3766ea4d21e3e26d25a5f2f69553 (diff)
downloadpostgresql-0dafed6fedf4da0e0e38c5961ae4b1540b4a8a5c.tar.gz
postgresql-0dafed6fedf4da0e0e38c5961ae4b1540b4a8a5c.zip
Fix off-by-one error in PGTYPEStimestamp_fmt_asc
When using %b or %B patterns to format a date, the code was simply using tm_mon as an index into array of month names. But that is wrong, because tm_mon is 1-based, while array indexes are 0-based. The result is we either use name of the next month, or a segfault (for December). Fix by subtracting 1 from tm_mon for both patterns, and add a regression test triggering the issue. Backpatch to all supported versions (the bug is there far longer, since at least 2003). Reported-by: Paul Spencer Backpatch-through: 9.4 Discussion: https://postgr.es/m/16143-0d861eb8688d3fef%40postgresql.org
Diffstat (limited to 'src/backend/access/gist')
0 files changed, 0 insertions, 0 deletions