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

Commit343bb13

Browse files
committed
Avoid too-large shift on 32-bit Windows.
Apparently, shifts greater than or equal to the width of the typeare undefined, and can surprisingly produce a non-zero value.Amit Kapila, with a comment by me.
1 parent6756c8a commit343bb13

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎src/backend/storage/ipc/dsm_impl.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,17 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
673673
/* Create new segment or open an existing one for attach. */
674674
if (op==DSM_OP_CREATE)
675675
{
676-
DWORDsize_high= (DWORD) (request_size >>32);
677-
DWORDsize_low= (DWORD)request_size;
676+
DWORDsize_high;
677+
DWORDsize_low;
678+
679+
/* Shifts >= the width of the type are undefined. */
680+
#ifdef_WIN64
681+
size_high=request_size >>32;
682+
#else
683+
size_high=0;
684+
#endif
685+
size_low= (DWORD)request_size;
686+
678687
hmap=CreateFileMapping(INVALID_HANDLE_VALUE,/* Use the pagefile */
679688
NULL,/* Default security attrs */
680689
PAGE_READWRITE,/* Memory is read/write */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp