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

Commita7e383d

Browse files
committed
Repair badly broken estimation of output buffer size in lquery_out().
1 parentf758097 commita7e383d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

‎contrib/ltree/ltree_io.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,22 +498,21 @@ lquery_out(PG_FUNCTION_ARGS)
498498
*ptr;
499499
inti,
500500
j,
501-
totallen=0;
501+
totallen=1;
502502
lquery_level*curqlevel;
503503
lquery_variant*curtlevel;
504504

505505
curqlevel=LQUERY_FIRST(in);
506506
for (i=0;i<in->numlevel;i++)
507507
{
508+
totallen++;
508509
if (curqlevel->numvar)
509-
totallen=(curqlevel->numvar*4)+1+curqlevel->totallen;
510+
totallen+=1+(curqlevel->numvar*4)+curqlevel->totallen;
510511
else
511-
totallen=2*11+4;
512-
totallen++;
512+
totallen+=2*11+4;
513513
curqlevel=LQL_NEXT(curqlevel);
514514
}
515515

516-
517516
ptr=buf= (char*)palloc(totallen);
518517
curqlevel=LQUERY_FIRST(in);
519518
for (i=0;i<in->numlevel;i++)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp