1
0
Fork 0
mirror of https://git.code.sf.net/p/zint/code synced 2025-06-01 23:58:27 -04:00

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
backend

View file

@ -115,6 +115,9 @@ static int buffer_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf
if (!(symbol->bitmap = (unsigned char *) raster_malloc(bm_bitmap_size, 0 /*prev_size*/))) {
return errtxt(ZINT_ERROR_MEMORY, symbol, 661, "Insufficient memory for bitmap buffer");
}
#ifdef ZINT_SANITIZEM /* Suppress clang -fsanitize=memory false positive */
memset(symbol->bitmap, 0, bm_bitmap_size);
#endif
if (plot_alpha) {
const size_t alpha_size = (size_t) symbol->bitmap_width * symbol->bitmap_height;
@ -178,10 +181,11 @@ static int save_raster_image_to_file(struct zint_symbol *symbol, const int image
}
if (rotate_angle) {
if (!(rotated_pixbuf = (unsigned char *) raster_malloc((size_t) image_width * image_height,
0 /*prev_size*/))) {
size_t image_size = (size_t) image_width * image_height;
if (!(rotated_pixbuf = (unsigned char *) raster_malloc((size_t) image_size, 0 /*prev_size*/))) {
return errtxt(ZINT_ERROR_MEMORY, symbol, 650, "Insufficient memory for pixel buffer");
}
memset(rotated_pixbuf, DEFAULT_PAPER, image_size);
}
/* Rotate image before plotting */