thinko in convertToJsonb()

From: Mark Dilger <mark(at)port25(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: thinko in convertToJsonb()
Date: 2014-12-09 02:11:16
Message-ID: 2FA1D6D6-78DC-4754-8E7D-360AE07DFE8A@port25.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The call:

reserveFromBuffer(&buffer, sizeof(VARHDRSZ))

is assuming that the size of varlena header is the same
size as the type used to return that size, which happens
to be so, but someone could easily change that macro
to:

#define VARHDRSZ ((int64) sizeof(int32))

And you'd want to reserve sizeof(int32), not sizeof(int64)
in convertToJsonb.

Perhaps the code really meant to say:

reserveFromBuffer(&buffer, VARHDRSZ)

mark

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2014-12-09 02:17:02 Re: Status of Commit fest 2014-10
Previous Message Peter Eisentraut 2014-12-09 01:59:41 Re: alter user set local_preload_libraries.