mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
QRCODE: fix out-of-bounds crash due to incorrect mode costings for
GS1 percents in `qr_in_alpha()`, ticket #300, props Andre Maute; also defensively re-calc version 40 mode to prevent possible further crashes common: move `debug_print_escape()` from library to common
This commit is contained in:
@ -677,20 +677,6 @@ static int reduced_charset(struct zint_symbol *symbol, struct zint_seg segs[], c
|
||||
return error_number;
|
||||
}
|
||||
|
||||
/* Helper for ZINT_DEBUG_PRINT to put all but graphical ASCII in angle brackets */
|
||||
static void debug_print_escape(const unsigned char *source, const int first_len, char *buf) {
|
||||
int i, j = 0;
|
||||
for (i = 0; i < first_len; i++) {
|
||||
const unsigned char ch = source[i];
|
||||
if (ch < 32 || ch >= 127) {
|
||||
j += sprintf(buf + j, "<%03o>", ch & 0xFF);
|
||||
} else {
|
||||
buf[j++] = ch;
|
||||
}
|
||||
}
|
||||
buf[j] = '\0';
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user