Thread: trivial patch for pg_dump blob problem
Hello! In case when there some error have occured getting blob data, instead of failing gracefully failing, it will probably segfault or loop forever. All of this will happen only on platforms where size_t is unsigned (e.g. on Linux systems modulo Linux/sparc32). Simple non-intrusive patch is below ;) Bye, Oleg --- postgresql-7.3.2/src/bin/pg_dump/pg_dump.c.orig Sat Feb 8 20:23:54 2003 +++ postgresql-7.3.2/src/bin/pg_dump/pg_dump.c Sat Feb 8 20:25:13 2003 @@ -1355,7 +1355,7 @@ do { cnt = lo_read(g_conn, loFd, buf, loBufSize); - if (cnt < 0) + if ((int)cnt < 0) { write_msg(NULL, "dumpBlobs(): error reading large object: %s", PQerrorMessage(g_conn));
Oleg Drokin <green@linuxhacker.ru> writes: > Simple non-intrusive patch is below ;) Since lo_read is declared to return int, I think a more correct patch is to change 'cnt' to be declared as int. I have fixed it that way. regards, tom lane
Hello! On Thu, Feb 13, 2003 at 05:58:04PM -0500, Tom Lane wrote: > > Simple non-intrusive patch is below ;) > Since lo_read is declared to return int, I think a more correct patch > is to change 'cnt' to be declared as int. I have fixed it that way. I was just thinking about architectures that might have size_t larger than 32 bit. Anyway, since lo_read() returns int, this is indeed unimportant and your fix is just better. Bye, Oleg