• R/O
  • HTTP
  • SSH
  • HTTPS

nvdajp: Commit

NVDA with Japanese branch


Commit MetaInfo

Revision1d464fe9c9ba53d0e84c16df6308e56c89d2f634 (tree)
Zeit2018-09-26 12:40:06
AutorMichael Curran <michaelDCurran@user...>
CommiterGitHub

Log Message

Work around crash in Google Chrome when navigating tweets on twitter.com (#8779)

* Gecko vbufBackend: work around bug in Google Chrome causing a crash on twitter.com due to IAccessible2_2::relationTargetsOfType buffer overrunning.

* Update what's new

* Address review comment.

Ändern Zusammenfassung

Diff

--- a/nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp
+++ b/nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp
@@ -30,10 +30,18 @@ http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
3030
3131 using namespace std;
3232
33-CComPtr<IAccessible2> getLabelElement(IAccessible2_2* element) {
33+CComPtr<IAccessible2> GeckoVBufBackend_t::getLabelElement(IAccessible2_2* element) {
3434 IUnknown** ppUnk=nullptr;
3535 long nTargets=0;
36- constexpr int numRelations=2;
36+ // We only need to request one relation target
37+ int numRelations=1;
38+ // However, a bug in Chrome causes a buffer overrun if numRelations is less than the total number of targets the node has.
39+ // Therefore, If this is Chrome, request all targets (by setting numRelations to 0) as this works around the bug.
40+ // There is no major performance hit to fetch all targets in Chrome as Chrome is already fetching all targets either way.
41+ // In Firefox there would be extra cross-proc calls.
42+ if(this->toolkitName.compare(L"Chrome")==0) {
43+ numRelations=0;
44+ }
3745 // the relation type string *must* be passed correctly as a BSTR otherwise we can see crashes in 32 bit Firefox.
3846 HRESULT res=element->get_relationTargetsOfType(CComBSTR(IA2_RELATION_LABELLED_BY),numRelations,&ppUnk,&nTargets);
3947 if(res!=S_OK) return nullptr;
@@ -275,6 +283,9 @@ void GeckoVBufBackend_t::versionSpecificInit(IAccessible2* pacc) {
275283 iaApp->Release();
276284 return;
277285 }
286+ if(toolkitName) {
287+ this->toolkitName = std::wstring(toolkitName, SysStringLen(toolkitName));
288+ }
278289 BSTR toolkitVersion = NULL;
279290 if (iaApp->get_toolkitVersion(&toolkitVersion) != S_OK) {
280291 iaApp->Release();
@@ -306,7 +317,7 @@ void GeckoVBufBackend_t::versionSpecificInit(IAccessible2* pacc) {
306317 SysFreeString(toolkitVersion);
307318 }
308319
309-bool isLabelVisible(IAccessible2* pacc2) {
320+bool GeckoVBufBackend_t::isLabelVisible(IAccessible2* pacc2) {
310321 CComQIPtr<IAccessible2_2> pacc2_2=pacc2;
311322 if(!pacc2_2) return false;
312323 auto targetAcc=getLabelElement(pacc2_2);
--- a/nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.h
+++ b/nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.h
@@ -32,6 +32,10 @@ class GeckoVBufBackend_t: public VBufBackend_t {
3232
3333 bool shouldDisableTableHeaders;
3434 bool hasEncodedAccDescription;
35+ std::wstring toolkitName;
36+
37+ bool isLabelVisible(IAccessible2* pacc2);
38+ CComPtr<IAccessible2> getLabelElement(IAccessible2_2* element);
3539
3640 protected:
3741
--- a/user_docs/en/changes.t2t
+++ b/user_docs/en/changes.t2t
@@ -3,6 +3,10 @@ What's New in NVDA
33
44 %!includeconf: ../changes.t2tconf
55
6+= 2018.3.2 =
7+This is a minor release to work around a crash in Google Chrome when navigating tweetts on www.twitter.com/
8+
9+
610 = 2018.3.1 =
711 This is a minor release to fix a critical bug in NVDA which caused 32 bit versions of Mozilla Firefox to crash. (#8759)
812
Show on old repository browser