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

Commit54a8af0

Browse files
committed
In a machine where INT64_IS_BUSTED, we can only support 32-bit values
for int8 and related types. However we might be talking to a clientthat has working int64; so pq_getmsgint64 really needs to check theincoming value and throw an overflow error if we can't represent itaccurately.
1 parent9f53cfd commit54a8af0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/backend/libpq/pqformat.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
2525
* Portions Copyright (c) 1994, Regents of the University of California
2626
*
27-
*$PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.37 2004/12/31 21:59:50 pgsql Exp $
27+
*$PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.38 2005/09/24 15:34:07 tgl Exp $
2828
*
2929
*-------------------------------------------------------------------------
3030
*/
@@ -501,8 +501,12 @@ pq_getmsgint64(StringInfo msg)
501501
l32=ntohl(l32);
502502

503503
#ifdefINT64_IS_BUSTED
504-
/*just lose the high half */
504+
/*error out if incoming value is wider than 32 bits */
505505
result=l32;
506+
if ((result<0) ? (h32!=-1) : (h32!=0))
507+
ereport(ERROR,
508+
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
509+
errmsg("binary value is out of range for type bigint")));
506510
#else
507511
result=h32;
508512
result <<=32;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp