#ifndef SkMSAN_DEFINED
#define SkMSAN_DEFINED
-#include <stddef.h> // size_t
+#include "SkTypes.h"
// Typically declared in LLVM's msan_interface.h. Easier for us to just re-declare.
extern "C" {
void __msan_check_mem_is_initialized(const volatile void*, size_t);
+ void __msan_unpoison (const volatile void*, size_t);
}
// Code that requires initialized inputs can call this to make it clear that
#endif
}
+// Lie to MSAN that this range of memory is initialized.
+// This can hide serious problems if overused. Every use of this should refer to a bug.
+static inline void sk_msan_mark_initialized(const void* begin, const void* end, const char* skbug) {
+ SkASSERT(skbug && 0 != strcmp(skbug, ""));
+#if defined(__has_feature)
+ #if __has_feature(memory_sanitizer)
+ __msan_unpoison(begin, (const char*)end - (const char*)begin);
+ #endif
+#endif
+}
+
#endif//SkMSAN_DEFINED
#include "SkJpegUtility.h"
#include "SkColorPriv.h"
#include "SkDither.h"
+#include "SkMSAN.h"
#include "SkScaledBitmapSampler.h"
#include "SkStream.h"
#include "SkTemplates.h"
convert_CMYK_to_RGB(srcRow, cinfo.output_width);
}
+ sk_msan_mark_initialized(srcRow, srcRow + cinfo.output_width * srcBytesPerPixel,
+ "skbug.com/4550");
+
sampler.next(srcRow);
if (bm->height() - 1 == y) {
// we're done
# http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
set -e
+set -x
-sanitizer=$1
-shift
-args="$@"
-
-export CC="$(which clang)"
-export CXX="$(which clang++)"
+export CC=clang
+export CXX=clang++
+$CC --version
-if [[ -z "${CC}" ]] || [[ -z "${CXX}" ]]; then
- echo "Couldn't find Clang on this machine!"
- exit 1
+if [[ "$1" == "memory" ]]; then
+ export GYP_DEFINES="skia_gpu=0 skia_no_fontconfig=1 skia_freetype_static=1 ${GYP_DEFINES}"
fi
+export GYP_DEFINES="skia_sanitizer=$1 ${GYP_DEFINES}"
-echo "CC=$CC"
-echo "CXX=$CXX"
-$CC --version
-
-export GYP_DEFINES="skia_sanitizer=$sanitizer ${GYP_DEFINES}"
-make ${args}
+shift
+make $@