From 9bf2742736a066910d866ba7a92d9e6cfc84a90b Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Thu, 29 Oct 2020 12:27:49 +0000 Subject: [PATCH] Bug 1672388 - Validate hyphenation data before freezing the shared memory, which will unmap it. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D94320 --- intl/hyphenation/glue/nsHyphenator.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/intl/hyphenation/glue/nsHyphenator.cpp b/intl/hyphenation/glue/nsHyphenator.cpp index 363fe6b29566..6efb59ba76ea 100644 --- a/intl/hyphenation/glue/nsHyphenator.cpp +++ b/intl/hyphenation/glue/nsHyphenator.cpp @@ -161,15 +161,16 @@ static UniquePtr LoadFromURI(nsIURI* aURI, bytesRead != available) { return nullptr; } - if (!shm->Freeze()) { - return nullptr; - } if (!mapped_hyph_is_valid_hyphenator( reinterpret_cast(buffer), bytesRead)) { return nullptr; } + if (!shm->Freeze()) { + return nullptr; + } + *aLength = bytesRead; return shm; }