Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d0d3c0

Browse files
committed
Cast to (void *) rather than (int *) when passing int64's to PQfn().
This is a possibly-vain effort to silence a Coverity warning aboutbogus endianness dependency. The code's fine, because it takes careof endianness issues for itself, but Coverity sees an int64 beingpassed to an int* argument and not unreasonably suspects something'swrong. I'm not sure if putting the void* cast in the way will shut itup; but it can't hurt and seems better from a documentation standpointanyway, since the pointer is not used as an int* in this code path.Just for a bit of additional safety, verify that the result lengthis 8 bytes as expected.Back-patch to 9.3 where the code in question was added.
1 parent089e5ab commit3d0d3c0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎src/interfaces/libpq/fe-lobj.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ lo_read(PGconn *conn, int fd, char *buf, size_t len)
290290
argv[1].u.integer= (int)len;
291291

292292
res=PQfn(conn,conn->lobjfuncs->fn_lo_read,
293-
(int*)buf,&result_len,0,argv,2);
293+
(void*)buf,&result_len,0,argv,2);
294294
if (PQresultStatus(res)==PGRES_COMMAND_OK)
295295
{
296296
PQclear(res);
@@ -441,8 +441,8 @@ lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence)
441441
argv[2].u.integer=whence;
442442

443443
res=PQfn(conn,conn->lobjfuncs->fn_lo_lseek64,
444-
(int*)&retval,&result_len,0,argv,3);
445-
if (PQresultStatus(res)==PGRES_COMMAND_OK)
444+
(void*)&retval,&result_len,0,argv,3);
445+
if (PQresultStatus(res)==PGRES_COMMAND_OK&&result_len==8)
446446
{
447447
PQclear(res);
448448
returnlo_ntoh64(retval);
@@ -607,8 +607,8 @@ lo_tell64(PGconn *conn, int fd)
607607
argv[0].u.integer=fd;
608608

609609
res=PQfn(conn,conn->lobjfuncs->fn_lo_tell64,
610-
(int*)&retval,&result_len,0,argv,1);
611-
if (PQresultStatus(res)==PGRES_COMMAND_OK)
610+
(void*)&retval,&result_len,0,argv,1);
611+
if (PQresultStatus(res)==PGRES_COMMAND_OK&&result_len==8)
612612
{
613613
PQclear(res);
614614
returnlo_ntoh64(retval);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp