[tor-commits] [tor-browser] 35/46: Bug 1777394 - Do not crash on inaccessible dictionary file. r=bholley, a=dmeehan
gitolite role
git at cupani.torproject.org
Wed Nov 16 20:43:15 UTC 2022
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch base-browser-102.5.0esr-12.0-1
in repository tor-browser.
commit b5b1c4935c3d37e0e36e8a281f4f4b69707b2077
Author: Jens Stutte <jstutte at mozilla.com>
AuthorDate: Mon Sep 5 11:29:45 2022 +0000
Bug 1777394 - Do not crash on inaccessible dictionary file. r=bholley, a=dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D156278
---
extensions/spellcheck/hunspell/glue/RLBoxHunspell.cpp | 9 ++++++---
extensions/spellcheck/hunspell/glue/mozHunspell.cpp | 1 +
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/extensions/spellcheck/hunspell/glue/RLBoxHunspell.cpp b/extensions/spellcheck/hunspell/glue/RLBoxHunspell.cpp
index 1f7325a0f778..20dc75f5e74b 100644
--- a/extensions/spellcheck/hunspell/glue/RLBoxHunspell.cpp
+++ b/extensions/spellcheck/hunspell/glue/RLBoxHunspell.cpp
@@ -42,13 +42,15 @@ RLBoxHunspell* RLBoxHunspell::Create(const nsCString& affpath,
const uint64_t defaultMaxSizeForSandbox =
wasm_rt_get_default_max_linear_memory_size();
- // We first get the size of the dictionary
+ // We first get the size of the dictionary.
+ // This is actually the first read we try on dpath and it might fail for
+ // whatever filesystem reasons (invalid path, unaccessible, ...).
Result<int64_t, nsresult> dictSizeResult =
mozHunspellFileMgrHost::GetSize(dpath);
- MOZ_RELEASE_ASSERT(dictSizeResult.isOk());
+ NS_ENSURE_TRUE(dictSizeResult.isOk(), nullptr);
int64_t dictSize = dictSizeResult.unwrap();
- MOZ_RELEASE_ASSERT(dictSize >= 0);
+ NS_ENSURE_TRUE(dictSize >= 0, nullptr);
// Next, we compute the expected memory needed for hunspell spell checking.
// This will vary based on the size of the dictionary file, which varies by
@@ -81,6 +83,7 @@ RLBoxHunspell* RLBoxHunspell::Create(const nsCString& affpath,
mozHunspellCallbacks::AllowFile(dpath);
}
+ // TODO Bug 1788857: Verify error handling in case of inaccessible file
return new RLBoxHunspell(std::move(sandbox), affpath, dpath);
}
diff --git a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
index 31ee4b7af71c..446ecb3b8612 100644
--- a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
+++ b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
@@ -419,6 +419,7 @@ nsresult mozHunspell::DictionaryData::LoadIfNecessary() {
RLBoxHunspell::Create(mAffixFileName, dictFileName));
if (!hunspell) {
mLoadFailed = true;
+ // TODO Bug 1788857: Verify error propagation in case of inaccessible file
return NS_ERROR_OUT_OF_MEMORY;
}
mHunspell = std::move(hunspell);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the tor-commits
mailing list