On Wed, May 27, 2009 at 11:56 AM, Amanda Walker <ama...@chromium.org> wrote:
> On Tue, May 26, 2009 at 11:31 PM, Brett Wilson <bre...@chromium.org> wrote:
>>
>> Don't bother doing an assertion when the next line will crash anyway:
>>  DCHECK(foo);
>>  foo->DoSomething();
>> will normally crash pretty obviously dereferencing a NULL pointer
>> (even though it will be inside DoSomething).
>
> Well, that all depends on what DoSomething does, what happens to be in low
> memory, whether or not it's also passed an index that's applied to some
> component of "this", etc.  If foo can be NULL at that point, for whatever
> reason, not checking it before calling DoSomething is probably a recipe for
> a security hole.

Like I said, if there are security considerations for your code, then
you need to use CHECK and not DCHECK.

Brett

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to