Skip site navigation (1) Skip section navigation (2)

Please, fix!!! The backend can crash on your system!

From: Alexis Wilke <alexis_wilke(at)yahoo(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Please, fix!!! The backend can crash on your system!
Date: 2001-03-29 12:25:20
Message-ID: 20010329122520.14149.qmail@web1102.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-bugs
If PostgreSQL failed to compile on your computer or you found a bug that
is likely to be specific to one platform then please fill out this form
and e-mail it to pgsql-ports(at)postgresql(dot)org(dot)

To report any other bug, fill out the form below and e-mail it to
pgsql-bugs(at)postgresql(dot)org(dot)

If you not only found the problem but solved it and generated a patch
then e-mail it to pgsql-patches(at)postgresql(dot)org instead.  Please use the
command "diff -c" to generate the patch.

You may also enter a bug report at http://www.postgresql.org/ instead of
e-mail-ing this form.

============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name		:	Alexis Wilke
Your email address	:	alexis(at)m2osw(dot)com


System Configuration
---------------------
  Architecture (example: Intel Pentium)  	: trust me, doesn't matter

  Operating System (example: Linux 2.0.26 ELF) 	: trust me, doesn't matter

  PostgreSQL version (example: PostgreSQL-7.0):   since PostgreSQL-6.5.x
                                                  and still in the code

  Compiler used (example:  gcc 2.8.0)		: trust me, doesn't matter


Please enter a FULL description of your problem:
------------------------------------------------

It crashes when pg_database is too large. This is because
the index is compare to max with <= instead of <. I already
fixed the bug on my system. That's at line 



Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible: 
----------------------------------------------------------------------

Create many database (or create/destroy the same many times).

Once the pg_database is more than one page (is 16Kb or more) then it
starts
crashing. (may not crash on all systems, but trust me, my fix
will work GREAT).



If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

Okay, so go in the following file:

./src/backend/utils/misc/database.c

and move to the line #183 (V7.0.1)

There, fix the for() as is:

	for(i = 0; i < max; i++)

Why? Well, because 'i' starts at 0, therefore, you
can't access the tuple number 'max'. If you look in
other source files, you will quickly see that all
these for() loops are starting with an index of
1 and use some special functions/macros to access
the tuple data.





__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

Responses

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2001-03-29 13:39:04
Subject: Re: Please, fix!!! The backend can crash on your system!
Previous:From: Dirk LutzebaeckDate: 2001-03-29 08:55:09
Subject: Re: INSERT/SELECT with ORDER BY

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group