1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-17 06:41:24 +03:00

17179 Commits

Author SHA1 Message Date
Tom Lane
abeae11765 Update release notes for security-related releases in all active branches.
Security: CVE-2007-0555, CVE-2007-0556
2007-02-02 00:11:02 +00:00
Tom Lane
b4ddb79af5 Repair insufficiently careful type checking for SQL-language functions:
we should check that the function code returns the claimed result datatype
every time we parse the function for execution.  Formerly, for simple
scalar result types we assumed the creation-time check was sufficient, but
this fails if the function selects from a table that's been redefined since
then, and even more obviously fails if check_function_bodies had been OFF.

This is a significant security hole: not only can one trivially crash the
backend, but with appropriate misuse of pass-by-reference datatypes it is
possible to read out arbitrary locations in the server process's memory,
which could allow retrieving database content the user should not be able
to see.  Our thanks to Jeff Trout for the initial report.

Security: CVE-2007-0555
2007-02-02 00:04:02 +00:00
Peter Eisentraut
65ada7c810 Translation updates 2007-01-31 08:12:56 +00:00
Tom Lane
372c651312 Correct an old logic error in btree page splitting: when considering a split
exactly at the point where we need to insert a new item, the calculation used
the wrong size for the "high key" of the new left page.  This could lead to
choosing an unworkable split, resulting in "PANIC: failed to add item to the
left sibling" (or "right sibling") failure.  Although this bug has been there
a long time, it's very difficult to trigger a failure before 8.2, since there
was generally a lot of free space on both sides of a chosen split.  In 8.2,
where the user-selected fill factor determines how much free space the code
tries to leave, an unworkable split is much more likely.  Report by Joe
Conway, diagnosis and fix by Heikki Linnakangas.
2007-01-27 20:53:52 +00:00
Tom Lane
4461eb17c6 Get pg_utf_mblen(), pg_utf2wchar_with_len(), and utf2ucs() all on the same
page about the maximum UTF8 sequence length we support (4 bytes since 8.1,
3 before that).  pg_utf2wchar_with_len never got updated to support 4-byte
characters at all, and in any case had a buffer-overrun risk in that it
could produce multiple pg_wchars from what mblen claims to be just one UTF8
character.  The only reason we don't have a major security hole is that most
callers allocate worst-case output buffers; the sole exception in released
versions appears to be pre-8.2 iwchareq() (ie, ILIKE), which can be crashed
due to zeroing out its return address --- but AFAICS that can't be exploited
for anything more than a crash, due to inability to control what gets written
there.  Per report from James Russell and Michael Fuhr.

Pre-8.1 the risk is much less, but I still think pg_utf2wchar_with_len's
behavior given an incomplete final character risks buffer overrun, so
back-patch that logic change anyway.

This patch also makes sure that UTF8 sequences exceeding the supported
length (whichever it is) are consistently treated as error cases, rather
than being treated like a valid shorter sequence in some places.
2007-01-24 17:12:41 +00:00
Tom Lane
234db5bae1 Relax an Assert() that has been found to be too strict in some situations
involving unions of types having typmods.  Variants of the failure are known
to occur in 8.1 and up; not sure if it's possible in 8.0 and 7.4, but since
the code exists that far back, I'll just patch 'em all.  Per report from
Brian Hurt.
2007-01-24 01:26:08 +00:00
Tatsuo Ishii
fe7b0fc35d Back port patch.
Call srandom() instead of srand().
pgbench calls random() later, so it should have called srandom().
On most platforms except Windows srandom() is actually identical
to srand(), so the bug only bites Windows users.
per bug report from Akio Ishida.
2007-01-13 03:24:55 +00:00
PostgreSQL Daemon
2ece6917e8 commit before tag ... REL7_4_15 2007-01-06 06:40:31 +00:00
Bruce Momjian
230ae1a106 Fix markup because older releases couldn't link to the reference section. 2007-01-06 04:17:15 +00:00
Bruce Momjian
c1478c8f57 Remove extra character added to top. 2007-01-06 03:36:32 +00:00
Bruce Momjian
77c7616482 Fix markup because lc_numeric didn't have an SGML tag in this release. 2007-01-06 03:14:32 +00:00
Tom Lane
6faab66422 Minor copy-editing for release note updates. 2007-01-05 22:35:13 +00:00
Bruce Momjian
37a86cd254 Stamp release 7.4.15. 2007-01-05 20:53:11 +00:00
Bruce Momjian
e105a651f7 Create release notes for 7.4.15. 2007-01-05 20:02:55 +00:00
Tom Lane
8d96a06d43 Fix regex_fixed_prefix() to cope reasonably well with regex patterns of the
form '^(foo)$'.  Before, these could never be optimized into indexscans.
The recent changes to make psql and pg_dump generate such patterns (for \d
commands and -t and related switches, respectively) therefore represented
a big performance hit for people with large pg_class catalogs, as seen in
recent gripe from Erik Jones.  While at it, be more paranoid about
case-sensitivity checking in multibyte encodings, and fix some other
corner cases in which a regex might be interpreted too liberally.
2007-01-03 22:39:57 +00:00
Tom Lane
0fbfdf55f8 Repair bug #2839: the various ExecReScan functions need to reset
ps_TupFromTlist in plan nodes that make use of it.  This was being done
correctly in join nodes and Result nodes but not in any relation-scan nodes.
Bug would lead to bogus results if a set-returning function appeared in the
targetlist of a subquery that could be rescanned after partial execution,
for example a subquery within EXISTS().  Bug has been around forever :-(
... surprising it wasn't reported before.
2006-12-26 19:27:20 +00:00
Tom Lane
8eb0f23a96 Mark to_number() and the numeric-type variants of to_char() as stable, not
immutable, because their results depend on lc_numeric; this is a longstanding
oversight.  We cannot force initdb for this in the back branches, but we can
at least provide correct catalog entries for future installations.
2006-11-28 19:19:16 +00:00
Tom Lane
e53a43bf17 Fix psql's \copy command to ensure that it cycles libpq back to the idle state
(in particular, causing the ReadyForQuery message to be eaten) before
returning from do_copy.  The only known consequence of failing to do so is
that get_prompt might show a wrong result for the %x transaction status
escape, as reported by Bernd Helmle; but it's possible there are other issues.

Back-patch as far as 7.4, the oldest version supporting %x.
2006-11-24 23:07:07 +00:00
Tom Lane
8637cd1ee8 Fix 1-byte buffer overrun when OID exceeds 1 billion. This probably can't
cause any serious harm in normal cases, but if you have gcc buffer overrun
checking turned on, that will notice.  Found by Jack Orenstein.  Problem
was already fixed in CVS HEAD.
2006-11-22 21:13:11 +00:00
Tom Lane
ddefff7247 Repair problems with hash indexes that span multiple segments: the hash code's
preference for filling pages out-of-order tends to confuse the sanity checks
in md.c, as per report from Balazs Nagy in bug #2737.  The fix is to ensure
that the smgr-level code always has the same idea of the logical EOF as the
hash index code does, by using ReadBuffer(P_NEW) where we are adding a single
page to the end of the index, and using smgrextend() to reserve a large batch
of pages when creating a new splitpoint.  The patch is a bit ugly because it
avoids making any changes in md.c, which seems the most prudent approach for a
backpatchable beta-period fix.  After 8.3 development opens, I'll take a look
at a cleaner but more invasive patch, in particular getting rid of the now
unnecessary hack to allow reading beyond EOF in mdread().

Backpatch as far as 7.4.  The bug likely exists in 7.3 as well, but because
of the magnitude of the 7.3-to-7.4 changes in hash, the later-version patch
doesn't even begin to apply.  Given the other known bugs in the 7.3-era hash
code, it does not seem worth trying to develop a separate patch for 7.3.
2006-11-19 21:33:46 +00:00
Tom Lane
5ae883f52b Repair bug #2694 concerning an ARRAY[] construct whose inputs are empty
sub-arrays.  Per discussion, if all inputs are empty arrays then result
must be an empty array too, whereas a mix of empty and nonempty arrays
should (and already did) draw an error.  In the back branches, the
construct was strict: any NULL input immediately yielded a NULL output;
so I left that behavior alone.  HEAD was simply ignoring NULL sub-arrays,
which doesn't seem very sensible.  For lack of a better idea it now
treats NULL sub-arrays the same as empty ones.
2006-11-06 18:21:58 +00:00
Tom Lane
4e4c165dad Fix "failed to re-find parent key" btree VACUUM failure by tweaking
_bt_pagedel to recover from the failure: just search the whole parent level
if searching to the right fails.  This does nothing for the underlying problem
that index keys became out-of-order in the grandparent level.  However, we
believe that there is no other consequence worse than slightly inefficient
searching, so this narrow patch seems like the safest solution for the back
branches.
2006-11-01 19:50:15 +00:00
Tom Lane
c4c0082262 Back-patch second version of AIX getaddrinfo fix. 2006-10-20 01:10:40 +00:00
Tom Lane
8df0bcc696 Work around reported problem that AIX's getaddrinfo() doesn't seem to zero
sin_port in the returned IP address struct when servname is NULL.  This has
been observed to cause failure to bind the stats collection socket, and
could perhaps cause other issues too.  Per reports from Brad Nicholson
and Chris Browne.
2006-10-19 17:26:51 +00:00
Tom Lane
62f9cbf424 Stamp 7.4.14. REL7_4_14 2006-10-12 19:42:03 +00:00
Tom Lane
1d5ad22c32 A bit of copy-editing on back-branch release notes. 2006-10-11 20:56:21 +00:00
Tom Lane
47cec0327e Repair incorrect check for coercion of unknown literal to ANYARRAY, a bug
I introduced in 7.4.1 :-(.  It's correct to allow unknown to be coerced to
ANY or ANYELEMENT, since it's a real-enough data type, but it most certainly
isn't an array datatype.  This can cause a backend crash but AFAICT is not
exploitable as a security hole.  Per report from Michael Fuhr.

Note: as fixed in HEAD, this changes a constant in the pg_stats view,
resulting in a change in the expected regression outputs.  The back-branch
patches have been hacked to avoid that, so that pre-existing installations
won't start failing their regression tests.
2006-10-11 20:21:28 +00:00
Tom Lane
1c2d02c499 CREATE TABLE ... LIKE ... should mark the columns it creates with
attislocal = true, since they are not really inherited but merely copied
from the original table.  I'm not sure if there are any cases where it makes
a real difference given the existing uses of the flag, but wrong is wrong.
This was fixed in passing in HEAD by the LIKE INCLUDING CONSTRAINTS patch,
but never back-patched.
2006-10-11 20:03:26 +00:00
Tom Lane
7b165e3ba5 Fix psql \d commands to behave properly when a pattern using regex | is given.
Formerly they'd emit '^foo|bar$' which is wrong because the anchors are
parsed as part of the alternatives; must emit '^(foo|bar)$' to get expected
behavior.  Same as bug found previously in similar_escape().  Already fixed
in HEAD, this is just back-porting the part of that patch that was a bug fix.
2006-10-10 16:15:37 +00:00
Bruce Momjian
f3fa771ccf Update libpq.rc for 7.3.16 and 7.4.14. Later releases use libpq.rc.in,
which was already updated.
2006-10-10 00:19:58 +00:00
Bruce Momjian
10d46101f9 Stamp releases 7.3.16, 7.4.14, 8.0.9, and 8.1.5. 2006-10-09 23:38:34 +00:00
Bruce Momjian
f18ace69dc Update release notes for releases 7.3.16, 7.4.14, 8.0.9, and 8.1.5. 2006-10-09 23:23:11 +00:00
Tom Lane
b1bc5d5dda Fix back-branch pg_regress scripts to try the "canonical" expected file if we
tried a variant file from resultmap and it didn't match.  This is already done
in HEAD's C-code version, and is needed because OpenBSD has recently migrated
to a more standard handling of float underflow --- see buildfarm results
from emu.
2006-10-09 01:45:57 +00:00
Tom Lane
d85820cfb2 Fix ancient oversight in psql's \d pattern processing code: when seeing two
quote chars inside quote marks, should emit one quote *and stay in inquotes
mode*.  No doubt the lack of reports of this have something to do with the
poor documentation of the feature ...
2006-10-07 22:21:57 +00:00
Tom Lane
9cd5c4fca2 Fix string_to_array() to correctly handle the case where there are
overlapping possible matches for the separator string, such as
string_to_array('123xx456xxx789', 'xx').
Also, revise the logic of replace(), split_part(), and string_to_array()
to avoid O(N^2) work from redundant searches and conversions to pg_wchar
format when there are N matches to the separator string.
Backpatched the full patch as far as 8.0.  7.4 also has the bug, but the
code has diverged a lot, so I just went for a quick-and-dirty fix of the
bug itself in that branch.
2006-10-07 00:12:12 +00:00
Tom Lane
e0c6d9761c date_trunc also accepts 'quarter'. Noted by Yoshihisa Nakano. 2006-10-01 18:54:57 +00:00
Tom Lane
67b74fa7c7 Clean up rather sloppy fix in HEAD for the ancient bug that CREATE CONVERSION
didn't create a dependency from the new conversion to its schema.  Back-patch
to all supported releases.
2006-08-31 17:31:55 +00:00
Teodor Sigaev
ef34386c88 Fix mistyping 2006-08-29 15:50:11 +00:00
Teodor Sigaev
3672084fe6 Fix bug introduced by last patch, thanks again to Mario Weilguni <mweilguni@sime.com> 2006-08-08 15:46:09 +00:00
Teodor Sigaev
8f0b1d044c fix bug about modifying value in shared buffer,
what was a reason to corrupt index.
Thank to Mario Weilguni <mweilguni@sime.com> to
discover a bug.
2006-08-07 17:42:12 +00:00
Alvaro Herrera
d7295afe5e Fix confusion between COPY FROM and COPY TO, per Gavin Sharry and Arul Shaji. 2006-07-31 01:09:52 +00:00
Teodor Sigaev
2962428b3a Fix bug corrupting query in gist consistent function.
Thank to Mario Weilguni <mweilguni@sime.com> to discover a bug.
2006-07-11 16:09:47 +00:00
Bruce Momjian
24ccd11a6c Fix dbmirror for new backslash escaping:
Martin Pitt [2006-06-16  0:15 +0200]:
> Upstream confirmed my reply in the last mail in [1]: the complete
> escaping logic in DBMirror.pl is seriously screwew.
>
> [1] http://archives.postgresql.org/pgsql-bugs/2006-06/msg00065.php

I finally found some time to debug this, and I think I found a better
patch than the one you proposed. Mine is still hackish and is still a
workaround around a proper quoting solution, but at least it repairs
the parsing without introducing the \' quoting again.

I consider this a band-aid patch to fix the recent security update.
PostgreSQL gurus, would you consider applying this until a better
solution is found for DBMirror.pl?

Martin Pitt        http://www.piware.de
2006-07-06 02:02:48 +00:00
Michael Meskes
9e6815ef0f Do not use already free'ed errmsg, bug found by Joachim Wieland
<joachim.wieland@credativ.de>
2006-06-19 09:20:32 +00:00
Michael Meskes
8fc6b3dbf3 Fixed two memory leaks in ecpglib. 2006-06-06 11:36:00 +00:00
Tom Lane
c8fc48e257 Fix copy-and-pasteo in Russian translation: message complaining about
HAVE_INT64_TIMESTAMP was mentioning PG_CONTROL_VERSION instead.
Victor Snezhko
2006-06-03 16:49:46 +00:00
Tom Lane
d4f4bc1cab Pre-8.0 branches need to cope with possibility that the system libc knows
about the recent changes in US DST law.  Add a variant horology file, so
that either the old or new rules will be considered valid test results.
2006-06-01 04:10:25 +00:00
Bruce Momjian
edec862bb6 Costmetic fix for bug template version stamp. 2006-05-22 01:34:20 +00:00
Tom Lane
82f56fad31 Stamp release 7.4.13. REL7_4_13 2006-05-21 21:54:02 +00:00
Tom Lane
d6a74fe494 Update release notes for upcoming releases. 2006-05-21 21:50:02 +00:00