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

Side by Side Diff: Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp

Issue 13578002: Merge 147392 "Simply GIFImageReader error handling" (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1453/
Patch Set: Created 7 years, 8 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 unified diff | Download patch
« no previous file with comments | « Source/WebCore/platform/image-decoders/gif/GIFImageReader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK ***** 2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * 4 *
5 * The contents of this file are subject to the Mozilla Public License Version 5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with 6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at 7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/ 8 * http://www.mozilla.org/MPL/
9 * 9 *
10 * Software distributed under the License is distributed on an "AS IS" basis, 10 * Software distributed under the License is distributed on an "AS IS" basis,
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 return true; 351 return true;
352 } 352 }
353 353
354 // Decode all frames before haltAtFrame. 354 // Decode all frames before haltAtFrame.
355 // This method uses GIFFrameContext:decode() to decode each frame; decoding erro r is reported to client as a critical failure. 355 // This method uses GIFFrameContext:decode() to decode each frame; decoding erro r is reported to client as a critical failure.
356 // Return true if decoding has progressed. Return false if an error has occurred . 356 // Return true if decoding has progressed. Return false if an error has occurred .
357 bool GIFImageReader::decode(GIFImageDecoder::GIFQuery query, unsigned haltAtFram e) 357 bool GIFImageReader::decode(GIFImageDecoder::GIFQuery query, unsigned haltAtFram e)
358 { 358 {
359 ASSERT(m_bytesRead <= m_data->size()); 359 ASSERT(m_bytesRead <= m_data->size());
360 360
361 if (!m_parseFailed && !parse(m_bytesRead, m_data->size() - m_bytesRead, quer y == GIFImageDecoder::GIFSizeQuery)) { 361 if (!parse(m_bytesRead, m_data->size() - m_bytesRead, query == GIFImageDecod er::GIFSizeQuery))
362 m_parseFailed = true;
363 return false; 362 return false;
364 }
365 363
366 if (query != GIFImageDecoder::GIFFullQuery) 364 if (query != GIFImageDecoder::GIFFullQuery)
367 return true; 365 return true;
368 366
369 while (m_currentDecodingFrame < std::min(m_frames.size(), static_cast<size_t >(haltAtFrame))) { 367 while (m_currentDecodingFrame < std::min(m_frames.size(), static_cast<size_t >(haltAtFrame))) {
370 bool frameDecoded = false; 368 bool frameDecoded = false;
371 GIFFrameContext* currentFrame = m_frames[m_currentDecodingFrame].get(); 369 GIFFrameContext* currentFrame = m_frames[m_currentDecodingFrame].get();
372 370
373 if (!currentFrame->decode(data(0), m_data->size(), m_client, &frameDecod ed)) 371 if (!currentFrame->decode(data(0), m_data->size(), m_client, &frameDecod ed))
374 return false; 372 return false;
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 rowPosition = 0; 816 rowPosition = 0;
819 rowsRemaining = m_frameContext->height; 817 rowsRemaining = m_frameContext->height;
820 818
821 // Clearing the whole suffix table lets us be more tolerant of bad data. 819 // Clearing the whole suffix table lets us be more tolerant of bad data.
822 suffix.fill(0); 820 suffix.fill(0);
823 for (int i = 0; i < clearCode; i++) 821 for (int i = 0; i < clearCode; i++)
824 suffix[i] = i; 822 suffix[i] = i;
825 stackp = 0; 823 stackp = 0;
826 return true; 824 return true;
827 } 825 }
OLDNEW
« no previous file with comments | « Source/WebCore/platform/image-decoders/gif/GIFImageReader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698