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

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

Issue 813943003: Fix handling of broken GIFs with weird frame sizes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: comments Created 5 years, 11 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 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1 /* -*- Mode: C; tab-width: 4; 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(GIFImageReader); 279 WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(GIFImageReader);
280 public: 280 public:
281 GIFImageReader(blink::GIFImageDecoder* client = 0) 281 GIFImageReader(blink::GIFImageDecoder* client = 0)
282 : m_client(client) 282 : m_client(client)
283 , m_state(GIFType) 283 , m_state(GIFType)
284 , m_bytesToConsume(6) // Number of bytes for GIF type, either "GIF87a" o r "GIF89a". 284 , m_bytesToConsume(6) // Number of bytes for GIF type, either "GIF87a" o r "GIF89a".
285 , m_bytesRead(0) 285 , m_bytesRead(0)
286 , m_version(0) 286 , m_version(0)
287 , m_screenWidth(0) 287 , m_screenWidth(0)
288 , m_screenHeight(0) 288 , m_screenHeight(0)
289 , m_sentSizeToClient(false)
289 , m_loopCount(cLoopCountNotSeen) 290 , m_loopCount(cLoopCountNotSeen)
290 , m_parseCompleted(false) 291 , m_parseCompleted(false)
291 { 292 {
292 } 293 }
293 294
294 ~GIFImageReader() 295 ~GIFImageReader()
295 { 296 {
296 } 297 }
297 298
298 void setData(PassRefPtr<blink::SharedBuffer> data) { m_data = data; } 299 void setData(PassRefPtr<blink::SharedBuffer> data) { m_data = data; }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 345
345 // Parsing state machine. 346 // Parsing state machine.
346 GIFState m_state; // Current decoder master state. 347 GIFState m_state; // Current decoder master state.
347 size_t m_bytesToConsume; // Number of bytes to consume for next stage of par sing. 348 size_t m_bytesToConsume; // Number of bytes to consume for next stage of par sing.
348 size_t m_bytesRead; // Number of bytes processed. 349 size_t m_bytesRead; // Number of bytes processed.
349 350
350 // Global (multi-image) state. 351 // Global (multi-image) state.
351 int m_version; // Either 89 for GIF89 or 87 for GIF87. 352 int m_version; // Either 89 for GIF89 or 87 for GIF87.
352 unsigned m_screenWidth; // Logical screen width & height. 353 unsigned m_screenWidth; // Logical screen width & height.
353 unsigned m_screenHeight; 354 unsigned m_screenHeight;
355 bool m_sentSizeToClient;
354 GIFColorMap m_globalColorMap; 356 GIFColorMap m_globalColorMap;
355 int m_loopCount; // Netscape specific extension block to control the number of animation loops a GIF renders. 357 int m_loopCount; // Netscape specific extension block to control the number of animation loops a GIF renders.
356 358
357 Vector<OwnPtr<GIFFrameContext> > m_frames; 359 Vector<OwnPtr<GIFFrameContext> > m_frames;
358 360
359 RefPtr<blink::SharedBuffer> m_data; 361 RefPtr<blink::SharedBuffer> m_data;
360 bool m_parseCompleted; 362 bool m_parseCompleted;
361 }; 363 };
362 364
363 #endif 365 #endif
OLDNEW
« no previous file with comments | « Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp ('k') | Source/platform/image-decoders/gif/GIFImageReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698