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

Commit1d80d6b

Browse files
Further reduce dependence on -fwrapv semantics in jsonb.
Commit108d2ad missed updating a few places in the jsonb codethat rely on signed integer wrapping for correctness. These canalso be fixed by using pg_abs_s32() to negate a signed integer(that is known to be negative) for comparison with an unsignedinteger.Reported-by: Alexander LakhinDiscussion:https://postgr.es/m/bfff906f-300d-81ea-83b7-f2c93845e7f2%40gmail.com
1 parentaa2d6b1 commit1d80d6b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ jsonb_array_element_text(PG_FUNCTION_ARGS)
990990
{
991991
uint32nelements=JB_ROOT_COUNT(jb);
992992

993-
if (-element>nelements)
993+
if (pg_abs_s32(element)>nelements)
994994
PG_RETURN_NULL();
995995
else
996996
element+=nelements;
@@ -4811,7 +4811,7 @@ jsonb_delete_idx(PG_FUNCTION_ARGS)
48114811

48124812
if (idx<0)
48134813
{
4814-
if (-idx>n)
4814+
if (pg_abs_s32(idx)>n)
48154815
idx=n;
48164816
else
48174817
idx=n+idx;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp