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

Commit7c5d57c

Browse files
committed
Fix portability issue in new jsonbsubs code.
On machines where sizeof(Datum) > sizeof(Oid) (that is, any 64-bitplatform), the previous coding would compute a misalignedworkspace->index pointer if nupper is odd. Architectures wheremisaligned access is a hard no-no would then fail. This appearsto explain why thorntail is unhappy but other buildfarm membersare not.
1 parentaa6e46d commit7c5d57c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ jsonb_subscript_fetch_old(ExprState *state,
356356
staticvoid
357357
jsonb_exec_setup(constSubscriptingRef*sbsref,
358358
SubscriptingRefState*sbsrefstate,
359-
SubscriptExecSteps*methods)
359+
SubscriptExecSteps*methods)
360360
{
361361
JsonbSubWorkspace*workspace;
362362
ListCell*lc;
@@ -368,9 +368,14 @@ jsonb_exec_setup(const SubscriptingRef *sbsref,
368368
nupper* (sizeof(Datum)+sizeof(Oid)));
369369
workspace->expectArray= false;
370370
ptr= ((char*)workspace)+MAXALIGN(sizeof(JsonbSubWorkspace));
371-
workspace->indexOid= (Oid*)ptr;
372-
ptr+=nupper*sizeof(Oid);
371+
372+
/*
373+
* This coding assumes sizeof(Datum) >= sizeof(Oid), else we might
374+
* misalign the indexOid pointer
375+
*/
373376
workspace->index= (Datum*)ptr;
377+
ptr+=nupper*sizeof(Datum);
378+
workspace->indexOid= (Oid*)ptr;
374379

375380
sbsrefstate->workspace=workspace;
376381

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp