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

826 Commits

Author SHA1 Message Date
Tom Lane
29cb46fa77 Fix several datatype input functions that were allowing unused bytes in their
results to contain uninitialized, unpredictable values.  While this was okay
as far as the datatypes themselves were concerned, it's a problem for the
parser because occurrences of the "same" literal might not be recognized as
equal by datumIsEqual (and hence not by equal()).  It seems sufficient to fix
this in the input functions since the only critical use of equal() is in the
parser's comparisons of ORDER BY and DISTINCT expressions.
Per a trouble report from Marc Cousin.

Patch all the way back.  Interestingly, array_in did not have the bug before
8.2, which may explain why the issue went unnoticed for so long.
2008-04-11 22:53:33 +00:00
Tom Lane
1f42e1cb68 The original patch to disallow non-passworded connections to non-superusers
failed to cover all the ways in which a connection can be initiated in dblink.
Plug the remaining holes.  Also, disallow transient connections in functions
for which that feature makes no sense (because they are only sensible as
part of a sequence of operations on the same connection).  Joe Conway

Security: CVE-2007-6601
2008-01-03 21:28:55 +00:00
Teodor Sigaev
505292eb41 Backpatch: Fix tsvector_out() and tsquery_out() to escape backslesh, add test of that.
Patch by Bruce Momjian <bruce@momjian.us>
2007-11-16 17:31:16 +00:00
Joe Conway
8145f00f27 Have crosstab variants treat NULL rowid as a category in its own right,
per suggestion from Tom Lane. This fixes crash-bug reported by Stefan
Schwarzer.
2007-11-10 05:02:22 +00:00
Teodor Sigaev
45cd13c8ab Fix crash of to_tsvector() function on huge input: compareWORD()
function didn't return correct result for word position greate than
limit.

Per report from Stuart Bishop <stuart@stuartbishop.net>
2007-09-26 10:44:54 +00:00
Tom Lane
08e72a644a Fix combo_decrypt() to throw an error for zero-length input when using a
padded encryption scheme.  Formerly it would try to access res[(unsigned) -1],
which resulted in core dumps on 64-bit machines, and was certainly trouble
waiting to happen on 32-bit machines (though in at least the known case
it was harmless because that byte would be overwritten after return).
Per report from Ken Colson; fix by Marko Kreen.
2007-08-23 16:16:20 +00:00
Joe Conway
62ca8db433 Restrict non-superusers to password authenticated connections
to prevent possible escalation of privilege. Provide new SECURITY
DEFINER functions with old behavior, but initially REVOKE ALL
from public for these functions. Per list discussion and design
proposed by Tom Lane.
2007-07-09 01:43:57 +00:00
Teodor Sigaev
a75602e4c6 Fix caching of unsuccessful initialization of parser or configuration.
Per report from Listmail <lists@peufeu.com>
2007-04-02 11:43:30 +00:00
Teodor Sigaev
bcac5703ec Fix backend crash in parsing incorrect tsquery.
Per report from Jon Rosebaugh <jon@inklesspen.com>
2007-02-12 14:19:26 +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
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
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
Bruce Momjian
48498602a0 Change \' to '', for SQL standards compliance. Backpatch to 7.3, 7.4,
and 8.0.  Later releases already patched.
2006-05-21 19:57:07 +00:00
Teodor Sigaev
e314c3f53f Detoast query in g_intbig_consistent and copy query in g_int_consistent.
Minor cleanups.
2006-04-03 10:27:28 +00:00
Neil Conway
ac2172d6f6 Patch from Marko Kreen:
pgcrypto crypt()/md5 and hmac() leak memory when compiled against
OpenSSL as openssl.c digest ->reset will do two DigestInit calls
against a context.  This happened to work with OpenSSL 0.9.6
but not with 0.9.7+.

Reason for the messy code was that I tried to avoid creating
wrapper structure to transport algorithm info and tried to use
OpenSSL context for it.  The fix is to create wrapper structure.

It also uses newer digest API to avoid memory allocations
on reset with newer OpenSSLs.

Thanks to Daniel Blaisdell for reporting it.
2006-02-18 20:49:00 +00:00
Joe Conway
fcacfc96a2 When the remote query result has a different number of columns
than the local query specifies (e.g. in the FROM clause),
throw an ERROR (instead of crashing). Fix for bug #2129 reported
by Akio Iwaasa.
2006-01-03 23:48:04 +00:00
Tom Lane
8dc7c8cf1d There is a signedness bug in Openwall gen_salt code that pgcrypto uses.
This makes the salt space for md5 and xdes algorithms a lot smaller than
it should be.

Marko Kreen
2006-01-03 23:46:51 +00:00
Teodor Sigaev
9e4caa5abe Fix stupid bug with sizeof 2005-12-06 18:22:13 +00:00
Tom Lane
01145f963f Prevent core dump in contrib version of autovacuum when a table has been
dropped.  Per report from daveg (not his patch, though).
2005-10-20 16:14:47 +00:00
Teodor Sigaev
8fb4451a4d Update Snowball. I have to update it because of
old version doesn't available on Snowball's site and new version
of stemmers can't be compiled with old interface.
2005-09-15 12:41:52 +00:00
Tom Lane
6f0da9545a int_array_enum function should be using fcinfo->flinfo->fn_extra for
working state, not fcinfo->context.  Silly oversight on my part in last
go-round of fixes.
2005-08-15 19:05:43 +00:00
Tom Lane
dc59b47518 cube_1 variant is needed in 7.4 branch, per results from buildfarm
machine 'kudu'.
2005-07-16 20:11:12 +00:00
Tom Lane
0a719d8935 Fix bogus "extern int errno;" in back branches, per Andrew Dunstan. 2005-07-16 15:23:29 +00:00
Teodor Sigaev
1891938e9c Prevent to divide by zero and range out of 0..1 2005-06-01 11:46:09 +00:00
Tom Lane
308f01c304 Change tsearch2 to not use the unsafe practice of creating functions
that return INTERNAL without also having INTERNAL arguments.  Since the
functions in question aren't meant to be called by hand anyway, I just
redeclared them to take 'internal' instead of 'text'.  Also add code
to ProcedureCreate() to enforce the restriction, as I should have done
to start with :-(
2005-05-03 16:51:45 +00:00
Tom Lane
c7b94bbad9 int_aggregate's int_enum() doesn't work correctly with arrays that
aren't 1-D, so give an error message instead of failing.  Per report
from Ron Mayer.
2005-04-23 05:39:01 +00:00
Teodor Sigaev
6091d62c9d Add comment about permissions on pg_ts* tables 2005-04-19 13:59:06 +00:00
Teodor Sigaev
7d19650a79 Fix various comparing functions 2005-03-31 15:12:08 +00:00
Tom Lane
b4fd104204 Previous "64-bit fix" for intagg didn't actually work. This is already
fixed properly in CVS tip, but we need a band-aid for back branches.
Per report from Ron Mayer.
2005-03-23 19:07:03 +00:00
Neil Conway
2450224e6b Some builds (depends on crypto engine support?) of OpenSSL
0.9.7x have EVP_DigestFinal function which which clears all of
EVP_MD_CTX.  This makes pgcrypto crash in functions which
re-use one digest context several times: hmac() and crypt()
with md5 algorithm.

Following patch fixes it by carring the digest info around
EVP_DigestFinal and re-initializing cipher.

Marko Kreen.
2005-03-12 06:55:14 +00:00
Teodor Sigaev
989a17a68c Prevent rank change in case of duplicate search terms 2005-03-05 16:19:33 +00:00
Tom Lane
ae8db9a7ab Make sure contrib C functions are marked strict where needed.
Kris Jurka
2005-01-29 22:35:30 +00:00
Tom Lane
b9fccbb71c Now that I look at it, int_array_enum() didn't work either. 2005-01-27 21:50:15 +00:00
Tom Lane
3393e65c6d Fix security and 64-bit issues in contrib/intagg. This code could
stand to be rewritten altogether, but for now just stick a finger in
the dike.
2005-01-27 21:35:56 +00:00
Neil Conway
db78e53fac Mark the text_soundex() function as "strict", to avoid crashing on NULL
input. Also, may as well mark it "cacheable" as well. From Kris Jurka.
2005-01-26 08:10:08 +00:00
Tom Lane
62a6019c49 Back-patch make_oidjoins_check security improvement. 2004-10-21 17:12:19 +00:00
Tom Lane
2d46f0e613 Repair possible failure to update hint bits back to disk, per
http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php.
I plan a more permanent fix in HEAD, but for the back branches it seems
best to just touch the places that actually have a problem.
2004-10-13 22:22:03 +00:00
Joe Conway
a1dd58e509 Hashed crosstab was dying with an SPI_finish error when the source SQL
produced no rows. Now it returns 0 rows instead. Adjusted regression
test for this case.
2004-08-11 01:02:08 +00:00
Teodor Sigaev
c0626280c7 Fix stupid bug in installcheck 2004-06-23 10:03:57 +00:00
Tom Lane
2e11ef8be8 Now needs to include <ctype.h>. 2004-06-12 20:31:48 +00:00
Teodor Sigaev
db688bc1c3 Remove asymetrical word processing in query and text 2004-06-07 16:48:49 +00:00
Bruce Momjian
84b64ab569 Fix problems in pg_autovacuum:
1) temp table crash

2) Check send_query() function call return value.

Backpatch to 7.4.X.
2004-05-26 18:48:37 +00:00
Teodor Sigaev
fb411a4768 Minimize memory allocation for void (but not null) value. 2004-03-25 16:50:49 +00:00
Bruce Momjian
f2cc5330cc In working through a pg_autovacuum problem with Joe Conway (which turned
out to be the same problem reported by Cott Lang which the previous
patch resolved) a new bug was uncovered when running with a debug level
of greater than 1.

This patch resolves this new found bug and fixes some of the other
debugging output to be more consistent.

Please apply to both HEAD and the 7.4 branch.


Matthew T. O'Connor
2004-03-22 03:57:19 +00:00
Bruce Momjian
774571fd08 Fix pg_autovacuum to handle unsigned and oids better.
Matthew T. O'Connor
2004-03-17 13:16:28 +00:00
Joe Conway
27ae96c2b6 When returning type "record", replace use of pgresultGetTupleDesc
with ReturnSetInfo->expectedDesc. This allows custom datatypes
(e.g. from tsearch2) to be returned at runtime. Previous behavior
depended on the type oid to match between the remote and local
database, which obviously doesn't work well for custom types.
Per report from Mark Gibson.
2004-02-24 06:07:34 +00:00
Joe Conway
78c97b156e Apply quote_literal to the start_with argument of connectby. Fixes problem
reported by David Garamond when working with bytea parent and child keys.
2004-02-24 05:26:07 +00:00
Tom Lane
6b534f3c33 Replace opendir/closedir calls throughout the backend with AllocateDir
and FreeDir routines modeled on the existing AllocateFile/FreeFile.
Like the latter, these routines will avoid failing on EMFILE/ENFILE
conditions whenever possible, and will prevent leakage of directory
descriptors if an elog() occurs while one is open.
Also, reduce PANIC to ERROR in MoveOfflineLogs() --- this is not
critical code and there is no reason to force a DB restart on failure.
All per recent trouble report from Olivier Hubaut.
2004-02-23 23:03:43 +00:00