general: cmake: add ZINT_SANITIZEM (clang -fsanitize=memory) option

and suppress errors in lib and backend tests (pretty sure they're
  nearly all false positives apart from maybe 2 non-initializations
  in "gif.c" (`pOut` buffer) and "raster.c" (`rotated_pixbuf`)
github: install de_DE.UTF-8 locale in ubuntu-debug also
This commit is contained in:
gitlost 2025-02-19 01:15:58 +00:00
parent 33135fc146
commit c7cf006e71
38 changed files with 177 additions and 129 deletions

View file

@ -43,7 +43,7 @@ INTERNAL int u_big5_test(const unsigned int u, unsigned char *dest);
/* Version of `u_big5()` taking unsigned int destination for backward-compatible testing */
static int u_big5_int(unsigned int u, unsigned int *d) {
unsigned char dest[2];
unsigned char dest[2] = {0}; /* Suppress clang -fsanitize=memory false positive */
int ret = u_big5_test(u, dest);
if (ret) {
*d = ret == 1 ? dest[0] : ((dest[0] << 8) | dest[1]);
@ -157,6 +157,8 @@ static int big5_utf8(struct zint_symbol *symbol, const unsigned char source[], i
unsigned int i, length;
unsigned int *utfdata = (unsigned int *) z_alloca(sizeof(unsigned int) * (*p_length + 1));
memset(utfdata, 0, sizeof(unsigned int) * (*p_length + 1)); /* Suppress clang -fsanitize=memory false positive */
error_number = utf8_to_unicode(symbol, source, utfdata, p_length, 0 /*disallow_4byte*/);
if (error_number != 0) {
return error_number;