mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
Fix allocation formula in llvmjit_expr.c
An array of LLVMBasicBlockRef is allocated with the size used for an
element being "LLVMBasicBlockRef *" rather than "LLVMBasicBlockRef".
LLVMBasicBlockRef is a type that refers to a pointer, so this did not
directly cause a problem because both should have the same size, still
it is incorrect.
This issue has been spotted while reviewing a different patch, and
exists since 2a0faed9d7, so backpatch all the way down.
Discussion: https://postgr.es/m/CA+hUKGLngd9cKHtTUuUdEo2eWEgUcZ_EQRbP55MigV2t_zTReg@mail.gmail.com
Backpatch-through: 14
This commit is contained in:
@@ -612,8 +612,8 @@ llvm_compile_expr(ExprState *state)
|
|||||||
LLVMBuildStore(b, l_sbool_const(1), v_resnullp);
|
LLVMBuildStore(b, l_sbool_const(1), v_resnullp);
|
||||||
|
|
||||||
/* create blocks for checking args, one for each */
|
/* create blocks for checking args, one for each */
|
||||||
b_checkargnulls =
|
b_checkargnulls = (LLVMBasicBlockRef *)
|
||||||
palloc(sizeof(LLVMBasicBlockRef *) * op->d.func.nargs);
|
palloc(sizeof(LLVMBasicBlockRef) * op->d.func.nargs);
|
||||||
for (int argno = 0; argno < op->d.func.nargs; argno++)
|
for (int argno = 0; argno < op->d.func.nargs; argno++)
|
||||||
b_checkargnulls[argno] =
|
b_checkargnulls[argno] =
|
||||||
l_bb_before_v(b_nonull, "b.%d.isnull.%d", opno,
|
l_bb_before_v(b_nonull, "b.%d.isnull.%d", opno,
|
||||||
|
|||||||
Reference in New Issue
Block a user