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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bounds check in ImageDecoder Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void WEBPImageDecoder::onSetData(SegmentReader*) 159 void WEBPImageDecoder::onSetData(SegmentReader*)
160 { 160 {
161 m_haveAlreadyParsedThisData = false; 161 m_haveAlreadyParsedThisData = false;
162 } 162 }
163 163
164 int WEBPImageDecoder::repetitionCount() const 164 int WEBPImageDecoder::repetitionCount() const
165 { 165 {
166 return failed() ? cAnimationLoopOnce : m_repetitionCount; 166 return failed() ? cAnimationLoopOnce : m_repetitionCount;
167 } 167 }
168 168
169 bool WEBPImageDecoder::frameIsCompleteAtIndex(size_t index) const 169 bool WEBPImageDecoder::frameIsFullyReceivedAtIndex(size_t index) const
170 { 170 {
171 if (!m_demux || m_demuxState <= WEBP_DEMUX_PARSING_HEADER)
172 return false;
173 if (!(m_formatFlags & ANIMATION_FLAG)) 171 if (!(m_formatFlags & ANIMATION_FLAG))
174 return ImageDecoder::frameIsCompleteAtIndex(index); 172 return ImageDecoder::frameIsFullyReceivedAtIndex(index) || frameIsComple teAtIndex(index);
scroggo_chromium 2016/05/24 13:55:14 Do you need "|| frameIsCompleteAtIndex(index)"? Is
aleksandar.stojiljkovic 2016/05/24 19:24:34 Yes, that is exactly the case. WebP parsing doesn'
175 bool frameIsLoadedAtIndex = index < m_frameBufferCache.size(); 173 return index < m_frameBufferCache.size() || failed();
176 return frameIsLoadedAtIndex;
177 } 174 }
178 175
179 float WEBPImageDecoder::frameDurationAtIndex(size_t index) const 176 float WEBPImageDecoder::frameDurationAtIndex(size_t index) const
180 { 177 {
181 return index < m_frameBufferCache.size() ? m_frameBufferCache[index].duratio n() : 0; 178 return index < m_frameBufferCache.size() ? m_frameBufferCache[index].duratio n() : 0;
182 } 179 }
183 180
184 bool WEBPImageDecoder::updateDemuxer() 181 bool WEBPImageDecoder::updateDemuxer()
185 { 182 {
186 if (failed()) 183 if (failed())
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 return false; 502 return false;
506 } 503 }
507 // FALLTHROUGH 504 // FALLTHROUGH
508 default: 505 default:
509 clear(); 506 clear();
510 return setFailed(); 507 return setFailed();
511 } 508 }
512 } 509 }
513 510
514 } // namespace blink 511 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698