From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix lo_read, lo_write, lo_truncate to cope with "size_t" length |
Date: | 2012-10-09 01:20:14 |
Message-ID: | E1TLOUY-0000Bg-2w@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix lo_read, lo_write, lo_truncate to cope with "size_t" length parameters.
libpq defines these functions as accepting "size_t" lengths ... but the
underlying backend functions expect signed int32 length parameters, and so
will misinterpret any value exceeding INT_MAX. Fix the libpq side to throw
error rather than possibly doing something unexpected.
This is a bug of long standing, but I doubt it's worth back-patching. The
problem is really pretty academic anyway with lo_read/lo_write, since any
caller expecting sane behavior would have to have provided a multi-gigabyte
buffer. It's slightly more pressing with lo_truncate, but still we haven't
supported large objects over 2GB until now.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/0e924c007dbb74f8f7dbdb75810c9b9a8ed6d3ec
Modified Files
--------------
doc/src/sgml/lobj.sgml | 56 ++++++++++++++++++++++++++++++++--------
src/interfaces/libpq/fe-lobj.c | 50 ++++++++++++++++++++++++++++++++---
2 files changed, 90 insertions(+), 16 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-10-09 01:53:30 | pgsql: Fix lo_import and lo_export to return useful error messages more |
Previous Message | Peter Eisentraut | 2012-10-09 00:37:15 | pgsql: Remove generation of repl_gram.h |