Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 6237450183639040: Issue 1283 - wrong usage of memset, fix sizeof, make proper initializing (Closed)

Created:
Sept. 1, 2014, 11:52 a.m. by sergei
Modified:
Oct. 17, 2014, 3:35 p.m.
Visibility:
Public.

Description

As well refactor a couple of places and fix bugs in the affected code - undeprecate `ATL::CComBSTR`. It's extensively used and only pollutes the compiler output, so we can miss some important warning. - fix bug in `src/plugin/AdblockPlusClient.cpp`. The size of `tml` (`TOKEN_MANDATORY_LABEL tml = {};`) does not include the length of SID, only the size of structure is expected. - remove dead code `BOOL CreateLowProcess(WCHAR* wszProcessName, WCHAR* cmdLine)` - [src/plugin/PluginDomTraverserBase.h] refactor `T* m_cacheElements;` to `std::vector<T> m_cacheElements` - [src/plugin/PluginDomTraverserBase.h] fix calls where `BSTR` is expected but `wchar_t*` was used - [src/plugin/PluginDomTraverserBase.h] use scoped lock instead of pairs of `m_criticalSection.Lock();` `m_criticalSection.Unlock();` - [src/plugin/PluginDomTraverserBase.h] add the check for the value of "abp" attribute. The user of some script could put any arbitrary value there which could cause some security vulnerabilities. - [src/plugin/PluginDomTraverserBase.h] remove `CPluginDomTraverserBase<T>::ShowNotification(CPluginTab* tab)` because the body was pointless.

Patch Set 1 #

Total comments: 32
Unified diffs Side-by-side diffs Delta from patch set Stats (+97 lines, -251 lines) Patch
M src/plugin/ATL_Deprecate.h View 1 chunk +0 lines, -1 line 0 comments Download
M src/plugin/AdblockPlusClient.cpp View 1 chunk +1 line, -1 line 0 comments Download
M src/plugin/NotificationMessage.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M src/plugin/PluginClass.cpp View 12 chunks +23 lines, -135 lines 6 comments Download
M src/plugin/PluginDomTraverserBase.h View 16 chunks +39 lines, -82 lines 6 comments Download
M src/plugin/PluginSettings.cpp View 1 chunk +4 lines, -7 lines 0 comments Download
M src/plugin/PluginSystem.cpp View 1 chunk +25 lines, -20 lines 1 comment Download
M src/shared/Communication.cpp View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 10
sergei
Sept. 1, 2014, 1:35 p.m. (2014-09-01 13:35:48 UTC) #1
Eric
First of all, this review mixes too many issues to be a good single commit. ...
Sept. 26, 2014, 4:36 p.m. (2014-09-26 16:36:40 UTC) #2
Eric
I've looked over everything else and found only small issues. If we remove the changes ...
Sept. 26, 2014, 6:07 p.m. (2014-09-26 18:07:23 UTC) #3
Oleksandr
http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/plugin/PluginClass.cpp File src/plugin/PluginClass.cpp (right): http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/plugin/PluginClass.cpp#newcode424 src/plugin/PluginClass.cpp:424: DWORD trueth = 1; That typo really jumps at ...
Oct. 6, 2014, 8:19 p.m. (2014-10-06 20:19:32 UTC) #4
sergei
I've split it into several codereview: Issue 1283 http://codereview.adblockplus.org/5163581322559488/ Issue #1466 http://codereview.adblockplus.org/5698769010032640/ No issue - ...
Oct. 8, 2014, 3:06 p.m. (2014-10-08 15:06:52 UTC) #5
Eric
http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/plugin/PluginDomTraverserBase.h File src/plugin/PluginDomTraverserBase.h (right): http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/plugin/PluginDomTraverserBase.h#newcode49 src/plugin/PluginDomTraverserBase.h:49: typedef ATL::CComCritSecLock<CComAutoCriticalSection> CriticalSectionLock; On 2014/10/08 15:06:52, sergei wrote: > ...
Oct. 8, 2014, 4:26 p.m. (2014-10-08 16:26:55 UTC) #6
sergei
http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/plugin/PluginDomTraverserBase.h File src/plugin/PluginDomTraverserBase.h (right): http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/plugin/PluginDomTraverserBase.h#newcode148 src/plugin/PluginDomTraverserBase.h:148: if (FAILED(pDoc->getElementsByTagName(ATL::CComBSTR(L"body"), &pBodyCollection)) || !pBodyCollection) I would say that ...
Oct. 8, 2014, 4:58 p.m. (2014-10-08 16:58:10 UTC) #7
Eric
http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/plugin/PluginDomTraverserBase.h File src/plugin/PluginDomTraverserBase.h (right): http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/plugin/PluginDomTraverserBase.h#newcode148 src/plugin/PluginDomTraverserBase.h:148: if (FAILED(pDoc->getElementsByTagName(ATL::CComBSTR(L"body"), &pBodyCollection)) || !pBodyCollection) On 2014/10/08 16:58:10, sergei ...
Oct. 8, 2014, 5:14 p.m. (2014-10-08 17:14:40 UTC) #8
Oleksandr
http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/plugin/PluginDomTraverserBase.h File src/plugin/PluginDomTraverserBase.h (right): http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/plugin/PluginDomTraverserBase.h#newcode148 src/plugin/PluginDomTraverserBase.h:148: if (FAILED(pDoc->getElementsByTagName(ATL::CComBSTR(L"body"), &pBodyCollection)) || !pBodyCollection) @Eric, I wouldn't say ...
Oct. 8, 2014, 5:37 p.m. (2014-10-08 17:37:46 UTC) #9
Eric
Oct. 8, 2014, 6:53 p.m. (2014-10-08 18:53:31 UTC) #10
http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/...
File src/plugin/PluginDomTraverserBase.h (right):

http://codereview.adblockplus.org/6237450183639040/diff/5629499534213120/src/...
src/plugin/PluginDomTraverserBase.h:148: if
(FAILED(pDoc->getElementsByTagName(ATL::CComBSTR(L"body"), &pBodyCollection)) ||
!pBodyCollection)
On 2014/10/08 17:37:46, Oleksandr wrote:
> this is not the only place where we use CComBSTR

I doubt I would feel as strongly if I had not already done the work to replace
CComBSTR already and mooted the issue entirely.

> However in all the time the plugin is in use we didn't
> really have many complaints about this. We did, however, had a lot of
complaints
> about other stuff. My point is that the problem is more hypothetical then
> veridical, and I think we shouldn't go out of our way to fix it right now. We
> should definitely create an P4 issue on this, IMHO.
> Shall we vote? Felix?

I am not at all convinced that we've never had reports from users that derive
from exception problems. For example,
https://adblockplus.org/forum/viewtopic.php?f=16&t=24513 contains a report that
looks like it might well be one. You have to dig into what that error might
mean, because it doesn't seem to be documented, but one of the suggested fixes
is to disable third-party extensions.

We have an large bias in our error reporting toward problems that are easy to
replicate and whose causes are understood over those that are hard to replicate
and whose very existence is murky. We have only started to trap exceptions at
all recently and we still have no mechanisms to collect such information from
installations in the field.

In any case, this concern has gotten larger than the present review.

Powered by Google App Engine
This is Rietveld