Re: [Pljava-dev] Re: Should creating a new base type require superuser status?

From: Kris Jurka <books(at)ejurka(dot)com>
To: Thomas Hallgren <thomas(at)tada(dot)se>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pljava-dev(at)pgfoundry(dot)org, pgsql-hackers(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: [Pljava-dev] Re: Should creating a new base type require superuser status?
Date: 2009-02-18 07:34:48
Message-ID: 499BBA18.2000309@ejurka.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pljava-dev

Thomas Hallgren wrote:
> Kris Jurka wrote:
>>
>> 3) By value: pljava does not correctly handle passed by value types
>> correctly, allowing access to random memory.
>>
> This is simply not true. There's no way a Java developer can access
> random memory through PL/Java.

No, the point is that the Java developer can provide some data which can
convince postgresql to fetch random data for the user.

Consider the attached type which is simply an int4 equivalent.
Depending on how you define it as passed by value or passed by reference
it will or will not work (attached).

This looks like it works:

jurka=# select '1'::intbyref, '2'::intbyval;
intbyref | intbyval
----------+----------
1 | 2
(1 row)

But it doesn't really:

jurka=# create table inttest (a intbyref, b intbyval);
CREATE TABLE
jurka=# insert into inttest values ('1', '2');
INSERT 0 1
jurka=# select * from inttest;
a | b
---+------------
1 | 2139062143
(1 row)

You can also get:

jurka=# select * from inttest;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

Kris Jurka

Attachment Content-Type Size
Int.java text/x-java 1.1 KB
create_passed_by_value.sql text/x-sql 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message BogDan Vatra 2009-02-18 09:06:52 Re: SE-PostgreSQL and row level security
Previous Message Tom Lane 2009-02-18 06:34:25 Re: The science of optimization in practical terms?

Browse pljava-dev by date

  From Date Subject
Next Message Thomas Hallgren 2009-02-18 11:23:07 Re: [Pljava-dev] Re: Should creating a new base type require superuser status?
Previous Message Thomas Hallgren 2009-02-18 06:07:11 Re: [Pljava-dev] Re: Should creating a new base type require superuser status?