From 0ef9fdf684ac31e4a978ad39ec24ff4a51c2f1f2 Mon Sep 17 00:00:00 2001 From: gitlost Date: Fri, 18 Dec 2020 03:05:08 +0000 Subject: [PATCH] AZTEC: lessen stack usage by sharing buffer between bit_pattern and binary_string --- backend/aztec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/aztec.c b/backend/aztec.c index 24569e17..e3c3acda 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -870,7 +870,10 @@ static void populate_map(short AztecMap[]) { INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { int x, y, i, j, p, data_blocks, ecc_blocks, layers, total_bits; - char binary_string[AZTEC_BIN_CAPACITY + 1], bit_pattern[20045], descriptor[42]; + char bit_pattern[20045]; /* Note 20045 > AZTEC_BIN_CAPACITY + 1 */ + /* To lessen stack usage, share binary_string buffer with bit_pattern, as accessed separately */ + char *binary_string = bit_pattern; + char descriptor[42]; char adjusted_string[AZTEC_MAX_CAPACITY + 1]; short AztecMap[AZTEC_MAP_SIZE]; unsigned char desc_data[4], desc_ecc[6];