1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-10 09:21:54 +03:00

Fix minor thinko in convertToJsonb().

The amount of space to reserve for the value's varlena header is
VARHDRSZ, not sizeof(VARHDRSZ).  The latter coding accidentally
failed to fail because of the way the VARHDRSZ macro is currently
defined; but if we ever change it to return size_t (as one might
reasonably expect it to do), convertToJsonb() would have failed.

Spotted by Mark Dilger.
This commit is contained in:
Tom Lane
2014-12-10 19:06:27 -05:00
parent eadd80c08d
commit 49b60a4be7

View File

@ -1377,7 +1377,7 @@ convertToJsonb(JsonbValue *val)
initStringInfo(&buffer);
/* Make room for the varlena header */
reserveFromBuffer(&buffer, sizeof(VARHDRSZ));
reserveFromBuffer(&buffer, VARHDRSZ);
convertJsonbValue(&buffer, &jentry, val, 0);