aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-30 22:52:34 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-30 22:53:01 +0100
commit0d9cb78f036554de8a9adc9196769e1fc709ea39 (patch)
tree5c8ace3413000916c42e52ea340fd8a3506855cd
parent1db233648fee07903f030adb4c94d8d76d4c3f8b (diff)
downloadfiv-0d9cb78f036554de8a9adc9196769e1fc709ea39.tar.gz
fiv-0d9cb78f036554de8a9adc9196769e1fc709ea39.tar.xz
fiv-0d9cb78f036554de8a9adc9196769e1fc709ea39.zip
Force sanitizers for debug builds
-rw-r--r--fastiv-io.c8
-rw-r--r--meson.build7
2 files changed, 11 insertions, 4 deletions
diff --git a/fastiv-io.c b/fastiv-io.c
index c40b589..b955622 100644
--- a/fastiv-io.c
+++ b/fastiv-io.c
@@ -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;
diff --git a/meson.build b/meson.build
index 3780515..34508c6 100644
--- a/meson.build
+++ b/meson.build
@@ -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'))