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

Commit4d924bd

Browse files
committed
Tighten up overflow check in path_recv, pursuant to code review inspired
by Ken Ashcraft's report. I think there is no actual bug here since ifthe int32 value does wrap a little bit, palloc will still reject it.Still it's better that the code be obviously correct.
1 parent0a54441 commit4d924bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/backend/utils/adt/geo_ops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.83 2003/11/29 19:51:58 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.84 2004/05/12 22:38:44 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1383,7 +1383,7 @@ path_recv(PG_FUNCTION_ARGS)
13831383

13841384
closed=pq_getmsgbyte(buf);
13851385
npts=pq_getmsgint(buf,sizeof(int32));
1386-
if (npts<0||npts >= (int32) (INT_MAX /sizeof(Point)))
1386+
if (npts<0||npts >= (int32) ((INT_MAX- offsetof(PATH,p[0])) /sizeof(Point)))
13871387
ereport(ERROR,
13881388
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
13891389
errmsg("invalid number of points in external \"path\" value")));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp