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

Unified Diff: src/codec/SkRawCodec.cpp

Issue 1757353002: Verify the full size returned by PIEX (Closed) Base URL: https://skia.googlesource.com/skia.git@gifFix
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkRawCodec.cpp
diff --git a/src/codec/SkRawCodec.cpp b/src/codec/SkRawCodec.cpp
index 9d0fb1cb251b288bf83ce279ff3d1440ed945551..524a438d2905023d60de3183df0ac6358aa73f2e 100644
--- a/src/codec/SkRawCodec.cpp
+++ b/src/codec/SkRawCodec.cpp
@@ -515,6 +515,11 @@ private:
if (::piex::IsRaw(&piexStream)
&& ::piex::GetPreviewImageData(&piexStream, &imageData) == ::piex::Error::kOk)
{
+ // Verify the size information, as it is only optional information for PIEX.
+ if (imageData.full_width == 0 || imageData.full_height == 0) {
+ return false;
+ }
+
dng_point cfaPatternSize(imageData.cfa_pattern_dim[1], imageData.cfa_pattern_dim[0]);
this->init(static_cast<int>(imageData.full_width),
static_cast<int>(imageData.full_height), cfaPatternSize);
@@ -670,7 +675,10 @@ SkCodec::Result SkRawCodec::onGetPixels(const SkImageInfo& requestedInfo, void*
SkISize SkRawCodec::onGetScaledDimensions(float desiredScale) const {
SkASSERT(desiredScale <= 1.f);
+
const SkISize dim = this->getInfo().dimensions();
+ SkASSERT(dim.fWidth != 0 && dim.fHeight != 0);
+
if (!fDngImage->isScalable()) {
return dim;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698