[babl] babl: slightly pad source buffers for creating conversions
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: slightly pad source buffers for creating conversions
- Date: Thu, 14 May 2020 16:46:51 +0000 (UTC)
commit 411dae60ae1c564090fa7c6a3943550ec1f1d1be
Author: Øyvind Kolås <pippin gimp org>
Date: Thu May 14 17:53:50 2020 +0200
babl: slightly pad source buffers for creating conversions
This is done because many babls conversions get optimized by C compilers
to read 16bytes of data at a time. Causing valgrind to report
"Invalid read of size 16" as a false positive. By padding the data at
least when creating conversions we mask the false positives.
babl/babl-conversion.c | 4 +++-
babl/babl-fish-reference.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c
index 7cca1f248..6c5d4f16b 100644
--- a/babl/babl-conversion.c
+++ b/babl/babl-conversion.c
@@ -487,7 +487,9 @@ babl_conversion_error (BablConversion *conversion)
conversion->error = 0.0000042;
}
- source = babl_calloc (test_pixels, fmt_source->format.bytes_per_pixel);
+ source = babl_calloc (test_pixels+1, fmt_source->format.bytes_per_pixel);
+ /* +1 is masking valgrind Invalid read of 16
+ * false positives */
destination = babl_calloc (test_pixels, fmt_destination->format.bytes_per_pixel);
ref_destination = babl_calloc (test_pixels, fmt_destination->format.bytes_per_pixel);
destination_rgba_double = babl_calloc (test_pixels, fmt_rgba_double->format.bytes_per_pixel);
diff --git a/babl/babl-fish-reference.c b/babl/babl-fish-reference.c
index f641a2150..a62f32ae1 100644
--- a/babl/babl-fish-reference.c
+++ b/babl/babl-fish-reference.c
@@ -1259,7 +1259,8 @@ babl_fish_reference_process_float (const Babl *babl,
}
else
{
- source_float_buf_alloc = babl_malloc (sizeof (float) * n *
+ /* the +1 is to mask a valgrind 'invalid read of size 16' false positive */
+ source_float_buf_alloc = babl_malloc (sizeof (float) * (n+1) *
(BABL (babl->fish.source)->format.model->components));
source_float_buf = source_float_buf_alloc;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]