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

Issue 6271025: Add Null check for kExtensionsPref dictionary... (Closed)

Created:
9 years, 11 months ago by cpu_(ooo_6.6-7.5)
Modified:
9 years, 7 months ago
CC:
chromium-reviews, Erik does not do reviews, pam+watch_chromium.org
Visibility:
Public.

Description

Add Null check for kExtensionsPref dictionary Do nothing if the preferences dic do not exist. CID 14614 BUG=none TEST=none

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -0 lines) Patch
M chrome/browser/extensions/extension_prefs.cc View 1 chunk +2 lines, -0 lines 2 comments Download

Messages

Total messages: 9 (0 generated)
cpu_(ooo_6.6-7.5)
coverity meat-bot
9 years, 11 months ago (2011-01-28 03:33:09 UTC) #1
Mattias Nissler (ping if slow)
http://codereview.chromium.org/6271025/diff/1/chrome/browser/extensions/extension_prefs.cc File chrome/browser/extensions/extension_prefs.cc (right): http://codereview.chromium.org/6271025/diff/1/chrome/browser/extensions/extension_prefs.cc#newcode1148 chrome/browser/extensions/extension_prefs.cc:1148: return; Hm. I'd say that the problem is really ...
9 years, 11 months ago (2011-01-28 09:27:03 UTC) #2
battre
The same holds of course for PrefService::GetList
9 years, 11 months ago (2011-01-28 09:35:10 UTC) #3
cpu_(ooo_6.6-7.5)
Ok, no problem, I withdraw this fix and let you fix it the right way. ...
9 years, 10 months ago (2011-01-29 02:31:50 UTC) #4
cpu_(ooo_6.6-7.5)
Just to be clear I am not a fan of CHECK() in these cases. On ...
9 years, 10 months ago (2011-01-29 02:33:02 UTC) #5
Mattias Nissler (ping if slow)
I'm not big fan of CHECK either. However, it's an invariant of the PrefService that ...
9 years, 10 months ago (2011-01-29 13:30:21 UTC) #6
Aaron Boodman
http://codereview.chromium.org/6271025/diff/1/chrome/browser/extensions/extension_prefs.cc File chrome/browser/extensions/extension_prefs.cc (right): http://codereview.chromium.org/6271025/diff/1/chrome/browser/extensions/extension_prefs.cc#newcode1148 chrome/browser/extensions/extension_prefs.cc:1148: return; On 2011/01/28 09:27:03, Mattias Nissler wrote: > Hm. ...
9 years, 10 months ago (2011-01-29 19:24:03 UTC) #7
Mattias Nissler (ping if slow)
Relevant to the pref system is the type when the preference gets registered. That means ...
9 years, 10 months ago (2011-01-29 19:34:32 UTC) #8
cpu_(ooo_6.6-7.5)
9 years, 10 months ago (2011-01-31 21:34:09 UTC) #9
On 2011/01/29 19:24:03, Aaron Boodman wrote:
>
http://codereview.chromium.org/6271025/diff/1/chrome/browser/extensions/exten...
> File chrome/browser/extensions/extension_prefs.cc (right):
> 
>
http://codereview.chromium.org/6271025/diff/1/chrome/browser/extensions/exten...
> chrome/browser/extensions/extension_prefs.cc:1148: return;
> On 2011/01/28 09:27:03, Mattias Nissler wrote:
> > Hm. I'd say that the problem is really with the PrefService code which
> shouldn't
> > return NULL in any case here. Could we resolve the report also by replacing
> this
> > code in PrefService::GetDictionary():
> > 
> >   const Value* value = pref->GetValue();
> >   if (value->GetType() == Value::TYPE_NULL)
> >     return NULL;
> >   return static_cast<const DictionaryValue*>(value);
> > 
> > by 
> > 
> >   const Value* value = pref->GetValue();
> >   CHECK(value->IsType(Value::TYPE_DICTIONARY))
> >   return static_cast<const DictionaryValue*>(value);
> 
> cpu, did you find a case of this actually returning NULL, or did coverity flag

coverity found it, because in other cases we do check null.


> this?
> 
> Mattias, what happens if the Preferences file gets changed by hand and the
> extensions key gets replaced with some other type? Will PrefService return a
> default DictionaryValue or will it return NULL?

Powered by Google App Engine
This is Rietveld 408576698