Reading from a read-only BLOB is allowed

Started by Gonzalo Paniagua Javierover 22 years ago2 messagesbugs
Jump to latest
#1Gonzalo Paniagua Javier
gonzalo@gnome-db.org

Hi!

It seems that postgres allows writing to a read-only blob opened like:

fd = lo_open (cnc, oid, INV_READ);

I've attached a simple test case and the Makefile to build it.

I'm using postgresql 7.3.3 (7.3.3-1 is the debian package version).

Is that the intended behaviour or is it a bug?

-Gonzalo

P.S.: please, CC me as I'm not suscribed to this list. Thanks.

--
Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
http://www.gnome-db.org/~gonzalo/

Attachments:

inversion-bug.ctext/x-c; charset=ISO-8859-1; name=inversion-bug.cDownload
Makefiletext/x-makefile; charset=ISO-8859-1; name=MakefileDownload
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Gonzalo Paniagua Javier (#1)
Re: Reading from a read-only BLOB is allowed

Gonzalo Paniagua Javier <gonzalo@gnome-db.org> writes:

It seems that postgres allows writing to a read-only blob opened like:
fd = lo_open (cnc, oid, INV_READ);

AFAICS from the code, INV_READ/WRITE attached to lo_open only determine
the kind of lock taken on the LO (shared or exclusive). Not sure
whether it's a bug to prohibit the other kind of access or not.

Note that there's no "security" issue here, since anyone is allowed to
write any LO anyway.

regards, tom lane