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

Unified Diff: Source/platform/image-decoders/png/PNGImageDecoder.cpp

Issue 481753002: Use Shadow DOM to display fallback content for images (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 3 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
Index: Source/platform/image-decoders/png/PNGImageDecoder.cpp
diff --git a/Source/platform/image-decoders/png/PNGImageDecoder.cpp b/Source/platform/image-decoders/png/PNGImageDecoder.cpp
index 86cff4c7c37adf2e9c959417eee6c65c3cd0013a..70b5315e69945a0dcff5a444ec3fceb027f90987 100644
--- a/Source/platform/image-decoders/png/PNGImageDecoder.cpp
+++ b/Source/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -142,8 +142,11 @@ public:
PNGImageDecoder* decoder = static_cast<PNGImageDecoder*>(png_get_progressive_ptr(m_png));
// We need to do the setjmp here. Otherwise bad things will happen.
+ // The libpng manual points out: ".. there are some uncertainties about the status of local variables after a longjmp, so the
+ // user may want to be careful about doing anything after setjmp returns non-zero besides returning itself." This is why
+ // we avoid referencing |decoder| in the event of an error.
if (setjmp(JMPBUF(m_png)))
- return decoder->setFailed();
+ return static_cast<PNGImageDecoder*>(png_get_progressive_ptr(m_png))->setFailed();
const char* segment;
while (unsigned segmentLength = data.getSomeData(segment, m_readOffset)) {

Powered by Google App Engine
This is Rietveld 408576698