Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 | 380 |
| 381 bool frameDecoded = false; | 381 bool frameDecoded = false; |
| 382 GIFFrameContext* currentFrame = m_frames[frameIndex].get(); | 382 GIFFrameContext* currentFrame = m_frames[frameIndex].get(); |
| 383 | 383 |
| 384 return currentFrame->decode(&reader, m_client, &frameDecoded) | 384 return currentFrame->decode(&reader, m_client, &frameDecoded) |
| 385 && (!frameDecoded || m_client->frameComplete(frameIndex)); | 385 && (!frameDecoded || m_client->frameComplete(frameIndex)); |
| 386 } | 386 } |
| 387 | 387 |
| 388 bool GIFImageReader::parse(GIFImageDecoder::GIFParseQuery query) | 388 bool GIFImageReader::parse(GIFImageDecoder::GIFParseQuery query) |
| 389 { | 389 { |
| 390 ASSERT(m_bytesRead <= m_data->size()); | 390 if (m_bytesRead >= m_data->size()) { |
|
Peter Kasting
2016/04/12 22:56:25
Add a comment describing the sequence that can res
scroggo_chromium
2016/04/13 12:16:43
Done.
| |
| 391 // This data has already been parsed. | |
| 392 return !m_client->failed(); | |
| 393 } | |
| 391 | 394 |
| 392 return parseData(m_bytesRead, m_data->size() - m_bytesRead, query); | 395 return parseData(m_bytesRead, m_data->size() - m_bytesRead, query); |
| 393 } | 396 } |
| 394 | 397 |
| 395 // Parse incoming GIF data stream into internal data structures. | 398 // Parse incoming GIF data stream into internal data structures. |
| 396 // Return true if parsing has progressed or there is not enough data. | 399 // Return true if parsing has progressed or there is not enough data. |
| 397 // Return false if a fatal error is encountered. | 400 // Return false if a fatal error is encountered. |
| 398 bool GIFImageReader::parseData(size_t dataPosition, size_t len, GIFImageDecoder: :GIFParseQuery query) | 401 bool GIFImageReader::parseData(size_t dataPosition, size_t len, GIFImageDecoder: :GIFParseQuery query) |
| 399 { | 402 { |
| 400 if (!len) { | 403 if (!len) { |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 840 rowIter = rowBuffer.begin(); | 843 rowIter = rowBuffer.begin(); |
| 841 rowsRemaining = m_frameContext->height(); | 844 rowsRemaining = m_frameContext->height(); |
| 842 | 845 |
| 843 // Clearing the whole suffix table lets us be more tolerant of bad data. | 846 // Clearing the whole suffix table lets us be more tolerant of bad data. |
| 844 for (int i = 0; i < clearCode; ++i) { | 847 for (int i = 0; i < clearCode; ++i) { |
| 845 suffix[i] = i; | 848 suffix[i] = i; |
| 846 suffixLength[i] = 1; | 849 suffixLength[i] = 1; |
| 847 } | 850 } |
| 848 return true; | 851 return true; |
| 849 } | 852 } |
| OLD | NEW |