stdlib: fix potential UB and integer overflow with huge allocations using malloc...