From 658cdd7a69d4cb5b192555a475d156b7c86b28a3 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Fri, 25 Nov 2016 20:50:35 +0000 Subject: [PATCH] Check for too many codewords after remainder in 144x144 symbols Bug report and patch by brunt, ticket #42 --- backend/dmatrix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/dmatrix.c b/backend/dmatrix.c index 2c0a93d0..b4aba235 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -1193,6 +1193,11 @@ int data_matrix_200(struct zint_symbol *symbol, const unsigned char source[], co // Now we know the symbol size we can handle the remaining data in the process buffer. symbols_left = matrixbytes[symbolsize] - binlen; binlen = dm200encode_remainder(binary, binlen, source, inputlen, last_mode, process_buffer, process_p, symbols_left); + + if (binlen > matrixbytes[symbolsize]) { + strcpy(symbol->errtxt, "Data too long to fit in symbol (E12A)"); + return ZINT_ERROR_TOO_LONG; + } H = matrixH[symbolsize]; W = matrixW[symbolsize];