Force sanitizers for debug builds

This commit is contained in:
Přemysl Eric Janouch 2021-11-30 22:52:34 +01:00
parent 1db233648f
commit 0d9cb78f03
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 11 additions and 4 deletions

View File

@ -299,8 +299,8 @@ load_wuffs_frame(struct load_wuffs_frame_context *ctx, GError **error)
uint32_t *out = (uint32_t *) surface_data;
for (uint32_t y = 0; y < ctx->height; y++) {
for (uint32_t x = 0; x < ctx->width; x++) {
uint16_t b = *in++, g = *in++, r = *in++, x = *in++;
*out++ = (x >> 14) << 30 |
uint32_t b = *in++, g = *in++, r = *in++, X = *in++;
*out++ = (X >> 14) << 30 |
(r >> 6) << 20 | (g >> 6) << 10 | (b >> 6);
}
}
@ -1671,8 +1671,8 @@ read_spng_thumbnail(
ihdr.color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA ||
!spng_get_trns(ctx, &trns)) {
for (size_t i = size / sizeof *data; i--; ) {
const uint8_t *unit = (const uint8_t *) &data[i],
a = unit[3],
const uint8_t *unit = (const uint8_t *) &data[i];
uint32_t a = unit[3],
b = unit[2] * a / 255,
g = unit[1] * a / 255,
r = unit[0] * a / 255;

View File

@ -6,6 +6,13 @@ add_project_arguments(
language : 'c',
)
if get_option('buildtype').startswith('debug')
flags = meson.get_compiler('c').get_supported_arguments(
'-fsanitize=address,undefined')
add_project_arguments(flags, language : ['c'])
add_project_link_arguments(flags, language : ['c'])
endif
# TODO(p): Use libraw_r later, when we start parallelizing/preloading.
libraw = dependency('libraw', required : get_option('libraw'))
librsvg = dependency('librsvg-2.0', required : get_option('librsvg'))