summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl/sanitizers.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /third_party/jpeg-xl/lib/jxl/sanitizers.h
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/sanitizers.h')
-rw-r--r--third_party/jpeg-xl/lib/jxl/sanitizers.h30
1 files changed, 11 insertions, 19 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/sanitizers.h b/third_party/jpeg-xl/lib/jxl/sanitizers.h
index adeaea67ed..bb133e9203 100644
--- a/third_party/jpeg-xl/lib/jxl/sanitizers.h
+++ b/third_party/jpeg-xl/lib/jxl/sanitizers.h
@@ -43,28 +43,18 @@ static JXL_INLINE JXL_MAYBE_UNUSED void UnpoisonMemory(const volatile void* m,
__msan_unpoison(m, size);
}
-static JXL_INLINE JXL_MAYBE_UNUSED void UnpoisonCStr(const char* c) {
- do {
- UnpoisonMemory(c, 1);
- } while (*c++);
-}
-
static JXL_INLINE JXL_MAYBE_UNUSED void MemoryIsInitialized(
const volatile void* m, size_t size) {
__msan_check_mem_is_initialized(m, size);
}
// Mark all the bytes of an image (including padding) as poisoned bytes.
-static JXL_INLINE JXL_MAYBE_UNUSED void PoisonImage(const PlaneBase& im) {
+template <typename T>
+static JXL_INLINE JXL_MAYBE_UNUSED void PoisonImage(const Plane<T>& im) {
PoisonMemory(im.bytes(), im.bytes_per_row() * im.ysize());
}
-template <typename T>
-static JXL_INLINE JXL_MAYBE_UNUSED void PoisonImage(const Image3<T>& im) {
- PoisonImage(im.Plane(0));
- PoisonImage(im.Plane(1));
- PoisonImage(im.Plane(2));
-}
+namespace {
// Print the uninitialized regions of an image.
template <typename T>
@@ -210,6 +200,8 @@ static JXL_INLINE JXL_MAYBE_UNUSED void CheckImageInitialized(
}
}
+} // namespace
+
#define JXL_CHECK_IMAGE_INITIALIZED(im, r) \
::jxl::msan::CheckImageInitialized(im, r, "im=" #im ", r=" #r);
@@ -221,13 +213,13 @@ static JXL_INLINE JXL_MAYBE_UNUSED void CheckImageInitialized(
// In non-msan mode these functions don't use volatile since it is not needed
// for the empty functions.
-static JXL_INLINE JXL_MAYBE_UNUSED void PoisonMemory(const void*, size_t) {}
-static JXL_INLINE JXL_MAYBE_UNUSED void UnpoisonMemory(const void*, size_t) {}
-static JXL_INLINE JXL_MAYBE_UNUSED void UnpoisonCStr(const char*) {}
-static JXL_INLINE JXL_MAYBE_UNUSED void MemoryIsInitialized(const void*,
- size_t) {}
+static JXL_INLINE JXL_MAYBE_UNUSED void PoisonMemory(const void* m,
+ size_t size) {}
+static JXL_INLINE JXL_MAYBE_UNUSED void UnpoisonMemory(const void* m,
+ size_t size) {}
+static JXL_INLINE JXL_MAYBE_UNUSED void MemoryIsInitialized(const void* m,
+ size_t size) {}
-static JXL_INLINE JXL_MAYBE_UNUSED void PoisonImage(const PlaneBase& im) {}
template <typename T>
static JXL_INLINE JXL_MAYBE_UNUSED void PoisonImage(const Plane<T>& im) {}