diff options
author | mtklein <mtklein@chromium.org> | 2016-02-06 19:12:23 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-06 19:12:23 -0800 |
commit | e721a8e883231af1878772ecd23be325113fcc48 (patch) | |
tree | 794d3a66459d5955f005272381e65f42423d90a3 /src | |
parent | 23e78d372f01867f6a96a436b9e5f24fd4f8e2e3 (diff) |
flags and hacks to get MSAN bot going
This disables a few tests in DM:
- one BlurLargeImage GM maybe is really broken
- FontMgrAndroidParser uses libexpat, which I've not (yet?) built from source,
so MSAN can't see into it.
This extends some of the MSAN stifling we added around SkImageDecoder_libjpeg to SkCodec, and skips .wbmps, .pngs, and .bmps. We're only seeing issues in colortables for .png and .bmp.
I think I can probably back out disabling Codec and the RAW image decodes...
they should all be covered by the libjpeg stifles.
BUG=skia:4550,skia:4900
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1673663002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot,Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-MSAN-Trybot
TBR=msarett@google.com
Review URL: https://codereview.chromium.org/1673663002
Diffstat (limited to 'src')
-rw-r--r-- | src/codec/SkJpegCodec.cpp | 13 | ||||
-rw-r--r-- | src/images/SkImageDecoder_libjpeg.cpp | 4 | ||||
-rw-r--r-- | src/opts/SkXfermode_opts.h | 14 |
3 files changed, 25 insertions, 6 deletions
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp index 112078b97c..aefe264f1a 100644 --- a/src/codec/SkJpegCodec.cpp +++ b/src/codec/SkJpegCodec.cpp @@ -6,6 +6,7 @@ */ #include "SkCodec.h" +#include "SkMSAN.h" #include "SkJpegCodec.h" #include "SkJpegDecoderMgr.h" #include "SkJpegUtility_codec.h" @@ -215,7 +216,7 @@ bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dst) { } /* - * Checks if we can natively scale to the requested dimensions and natively scales the + * Checks if we can natively scale to the requested dimensions and natively scales the * dimensions if possible */ bool SkJpegCodec::onDimensionsSupported(const SkISize& size) { @@ -308,6 +309,7 @@ SkCodec::Result SkJpegCodec::onGetPixels(const SkImageInfo& dstInfo, for (uint32_t y = 0; y < dstHeight; y++) { // Read rows of the image uint32_t lines = jpeg_read_scanlines(dinfo, &dstRow, 1); + sk_msan_mark_initialized(dstRow, dstRow + dstRowBytes, "skbug.com/4550"); // If we cannot read enough rows, assume the input is incomplete if (lines != 1) { @@ -399,24 +401,27 @@ SkCodec::Result SkJpegCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, return kSuccess; } -int SkJpegCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { +int SkJpegCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) { // Set the jump location for libjpeg errors if (setjmp(fDecoderMgr->getJmpBuf())) { return fDecoderMgr->returnFailure("setjmp", kInvalidInput); } // Read rows one at a time JSAMPLE* dstRow; + size_t srcRowBytes = get_row_bytes(fDecoderMgr->dinfo()); if (fSwizzler) { // write data to storage row, then sample using swizzler dstRow = fSrcRow; } else { // write data directly to dst + SkASSERT(count == 1 || dstRowBytes >= srcRowBytes); dstRow = (JSAMPLE*) dst; } for (int y = 0; y < count; y++) { // Read row of the image uint32_t rowsDecoded = jpeg_read_scanlines(fDecoderMgr->dinfo(), &dstRow, 1); + sk_msan_mark_initialized(dstRow, dstRow + srcRowBytes, "skbug.com/4550"); if (rowsDecoded != 1) { fDecoderMgr->dinfo()->output_scanline = this->dstInfo().height(); return y; @@ -425,9 +430,9 @@ int SkJpegCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { if (fSwizzler) { // use swizzler to sample row fSwizzler->swizzle(dst, dstRow); - dst = SkTAddOffset<JSAMPLE>(dst, rowBytes); + dst = SkTAddOffset<JSAMPLE>(dst, dstRowBytes); } else { - dstRow = SkTAddOffset<JSAMPLE>(dstRow, rowBytes); + dstRow = SkTAddOffset<JSAMPLE>(dstRow, dstRowBytes); } } return count; diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp index 6a3ae87b6a..89bfefcd45 100644 --- a/src/images/SkImageDecoder_libjpeg.cpp +++ b/src/images/SkImageDecoder_libjpeg.cpp @@ -509,6 +509,8 @@ SkImageDecoder::Result SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* for (int y = 0;; y++) { JSAMPLE* rowptr = (JSAMPLE*)srcRow; int row_count = jpeg_read_scanlines(&cinfo, &rowptr, 1); + sk_msan_mark_initialized(srcRow, srcRow + cinfo.output_width * srcBytesPerPixel, + "skbug.com/4550"); if (0 == row_count) { // if row_count == 0, then we didn't get a scanline, // so return early. We will return a partial image. @@ -525,8 +527,6 @@ SkImageDecoder::Result SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap* 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) { diff --git a/src/opts/SkXfermode_opts.h b/src/opts/SkXfermode_opts.h index f15094c98b..31817f5f61 100644 --- a/src/opts/SkXfermode_opts.h +++ b/src/opts/SkXfermode_opts.h @@ -9,6 +9,7 @@ #define Sk4pxXfermode_DEFINED #include "Sk4px.h" +#include "SkMSAN.h" #include "SkNx.h" #include "SkXfermode_proccoeff.h" @@ -202,6 +203,17 @@ XFERMODE_AA(Plus) { // [ clamp( (1-AA)D + (AA)(S+D) ) == clamp(D + AA*S) ] #undef XFERMODE_AA +// Src and Clear modes are safe to use with unitialized dst buffers, +// even if the implementation branches based on bytes from dst (e.g. asserts in Debug mode). +// For those modes, just lie to MSAN that dst is always intialized. +template <typename Xfermode> static void mark_dst_initialized_if_safe(void*, void*) {} +template <> void mark_dst_initialized_if_safe<Src>(void* dst, void* end) { + sk_msan_mark_initialized(dst, end, "Src doesn't read dst."); +} +template <> void mark_dst_initialized_if_safe<Clear>(void* dst, void* end) { + sk_msan_mark_initialized(dst, end, "Clear doesn't read dst."); +} + template <typename Xfermode> class Sk4pxXfermode : public SkProcCoeffXfermode { public: @@ -209,6 +221,7 @@ public: : INHERITED(rec, mode) {} void xfer32(SkPMColor dst[], const SkPMColor src[], int n, const SkAlpha aa[]) const override { + mark_dst_initialized_if_safe<Xfermode>(dst, dst+n); if (nullptr == aa) { Sk4px::MapDstSrc(n, dst, src, Xfermode()); } else { @@ -217,6 +230,7 @@ public: } void xfer16(uint16_t dst[], const SkPMColor src[], int n, const SkAlpha aa[]) const override { + mark_dst_initialized_if_safe<Xfermode>(dst, dst+n); SkPMColor dst32[4]; while (n >= 4) { dst32[0] = SkPixel16ToPixel32(dst[0]); |