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

Side by Side Diff: third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp

Issue 1937033002: Fix crash in CSSStyleSheetResource::appendData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | 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 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 6 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (!m_decodedSheetText.isNull()) 95 if (!m_decodedSheetText.isNull())
96 return m_decodedSheetText; 96 return m_decodedSheetText;
97 97
98 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory 98 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory
99 return decodedText(); 99 return decodedText();
100 } 100 }
101 101
102 void CSSStyleSheetResource::appendData(const char* data, size_t length) 102 void CSSStyleSheetResource::appendData(const char* data, size_t length)
103 { 103 {
104 Resource::appendData(data, length); 104 Resource::appendData(data, length);
105 if (!m_data)
Nate Chapin 2016/05/02 19:00:43 This should only be possible when m_options.dataBu
Charlie Harrison 2016/05/02 19:27:56 Ah good point.
106 return;
105 if (m_didNotifyFirstData) 107 if (m_didNotifyFirstData)
106 return; 108 return;
107 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); 109 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
108 while (StyleSheetResourceClient* c = w.next()) 110 while (StyleSheetResourceClient* c = w.next())
109 c->didAppendFirstData(this); 111 c->didAppendFirstData(this);
Nate Chapin 2016/05/02 19:00:43 I'm wondering whether this bug is happening when t
Charlie Harrison 2016/05/02 19:27:56 Hm well there's only one client of didAppendFirstD
110 m_didNotifyFirstData = true; 112 m_didNotifyFirstData = true;
111 } 113 }
112 114
113 void CSSStyleSheetResource::checkNotify() 115 void CSSStyleSheetResource::checkNotify()
114 { 116 {
115 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify() 117 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify()
116 if (m_data) 118 if (m_data)
117 m_decodedSheetText = decodedText(); 119 m_decodedSheetText = decodedText();
118 120
119 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); 121 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 191
190 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 192 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
191 193
192 // Check if this stylesheet resource didn't conflict with 194 // Check if this stylesheet resource didn't conflict with
193 // another resource and has indeed been added to the cache. 195 // another resource and has indeed been added to the cache.
194 if (memoryCache()->contains(this)) 196 if (memoryCache()->contains(this))
195 m_parsedStyleSheetCache->addedToMemoryCache(); 197 m_parsedStyleSheetCache->addedToMemoryCache();
196 } 198 }
197 199
198 } // namespace blink 200 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698