AZTEC: fix out-of-bounds crash when user-specified size given,

ticket #300, props Andre Maute;
  fix 4-layer compact block max (76 -> 64);
  fix encoding of byte-blocks > 11-bit limit
library: fix 21-bit Unicode conversion in `escape_char_process()`;
  fix restricting escaped data length by using de-escaped length to
  check (`escape_char_process()` adapted to do length only calc
  also)
This commit is contained in:
gitlost 2023-11-23 16:31:44 +00:00
parent 06ae7c1b7a
commit 7c4a538248
9 changed files with 640 additions and 181 deletions

View file

@ -3802,7 +3802,8 @@ int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source,
return 0;
}
INTERNAL int escape_char_process_test(struct zint_symbol *symbol, unsigned char *input_string, int *length);
INTERNAL int escape_char_process_test(struct zint_symbol *symbol, unsigned char *input_string, int *length,
unsigned char *escaped_string);
#include "../gs1.h"
@ -3850,13 +3851,15 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
}
if (is_escaped) {
memcpy(escaped, expected, expected_len);
if (symbol->input_mode & ESCAPE_MODE) {
ret = escape_char_process_test(symbol, (unsigned char *) escaped, &expected_len);
ret = escape_char_process_test(symbol, (unsigned char *) expected, &expected_len,
(unsigned char *) escaped);
if (ret != 0) {
sprintf(msg, "escape_char_process %d != 0", ret);
return 3;
}
} else {
memcpy(escaped, expected, expected_len);
}
if (is_extra_escaped) {
/* Remove any Code 128 special escapes */