Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1390)

Unified Diff: Source/platform/image-encoders/skia/WEBPImageEncoder.cpp

Issue 1234083003: Canvas.toDataURL to use SkBitmap::readPixels to avoid uninitialized memory (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: batter asan fix Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/ImageBuffer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/image-encoders/skia/WEBPImageEncoder.cpp
diff --git a/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp b/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp
index 3f00f6797e6132f1ceeb86dd3574aac64f9b9cf1..e82e4bffa23940a81d8f68219ebb6a53e62eb6e9 100644
--- a/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp
+++ b/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp
@@ -53,9 +53,8 @@ static bool rgbPictureImport(const unsigned char* pixels, bool premultiplied, We
// Write the RGB pixels to an rgb data buffer, alpha premultiplied, then import the rgb data.
- Vector<unsigned char> rgb;
size_t pixelCount = picture->height * picture->width;
- rgb.reserveInitialCapacity(pixelCount * 3);
+ Vector<unsigned char> rgb(pixelCount * 3);
Noel Gordon 2015/07/21 00:48:36 Overall patch seems fine, but just to confirm, the
for (unsigned char* data = rgb.data(); pixelCount-- > 0; pixels += 4) {
unsigned char alpha = pixels[3];
« no previous file with comments | « Source/platform/graphics/ImageBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698