insist SkPngEncoder's input is initialized

I'd rather catch uninitialized input here than
somewhere deep down in zlib or libpng.

Bug: chromium:1013368
Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN
Change-Id: I37f5a66a8fc12c7e0ce6d3100de94021bb5343ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248551
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2019-10-14 10:28:25 -05:00 committed by Skia Commit-Bot
parent 729c78d617
commit 33c36e05c3

View File

@ -15,6 +15,7 @@
#include "include/private/SkImageInfoPriv.h"
#include "src/codec/SkColorTable.h"
#include "src/codec/SkPngPriv.h"
#include "src/core/SkMSAN.h"
#include "src/images/SkImageEncoderFns.h"
#include <vector>
@ -421,6 +422,8 @@ bool SkPngEncoder::onEncodeRows(int numRows) {
const void* srcRow = fSrc.addr(0, fCurrRow);
for (int y = 0; y < numRows; y++) {
sk_msan_assert_initialized(srcRow,
(const uint8_t*)srcRow + (fSrc.width() << fSrc.shiftPerPixel()));
fEncoderMgr->proc()((char*)fStorage.get(),
(const char*)srcRow,
fSrc.width(),