postgres.git / summary / log / commit / refs

commit    5a4dc4aabd0345a194d27219f2424eb3dd3bf8fb
Author:   Michael Paquier <michael@paquier.xyz>
Date:     Thu Dec 11 01:25:48 2025 +0000
First released in: 14.21, 15.16, 16.12, 17.8, 18.2

    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 2a0faed9d702, so backpatch all the way down.
    
    Discussion: https://postgr.es/m/CA+hUKGLngd9cKHtTUuUdEo2eWEgUcZ_EQRbP55MigV2t_zTReg@mail.gmail.com
    Backpatch-through: 14


src/backend/jit/llvm/llvmjit_expr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c index 56aa5ba2ce7..c6a7b72b76d 100644 --- a/src/backend/jit/llvm/llvmjit_expr.c +++ b/src/backend/jit/llvm/llvmjit_expr.c @@ -612,8 +612,8 @@ llvm_compile_expr(ExprState *state) LLVMBuildStore(b, l_sbool_const(1), v_resnullp); /* create blocks for checking args, one for each */ - b_checkargnulls = - palloc(sizeof(LLVMBasicBlockRef *) * op->d.func.nargs); + b_checkargnulls = (LLVMBasicBlockRef *) + palloc(sizeof(LLVMBasicBlockRef) * op->d.func.nargs); for (int argno = 0; argno < op->d.func.nargs; argno++) b_checkargnulls[argno] = l_bb_before_v(b_nonull, "b.%d.isnull.%d", opno, [parent: d62a258cd45a]