diff options
author | inferno@chromium.org <inferno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-12 21:22:12 +0000 |
---|---|---|
committer | inferno@chromium.org <inferno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-12 21:22:12 +0000 |
commit | bcf1de5da4d370c83c05428e4a55c20d55975cc6 (patch) | |
tree | e065213de10687c8b99e0a42fdcc10befcb02bff /net/base | |
parent | 5d96aa43d6a17e398e576deacd6b24f79570f516 (diff) | |
download | chromium_src-bcf1de5da4d370c83c05428e4a55c20d55975cc6.zip chromium_src-bcf1de5da4d370c83c05428e4a55c20d55975cc6.tar.gz chromium_src-bcf1de5da4d370c83c05428e4a55c20d55975cc6.tar.bz2 |
Fixes a crash when xdg_mime library is unable to handle a long file path.
BUG=48733
TEST=None
Review URL: http://codereview.chromium.org/2980002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52130 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/mime_util.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc index 976aab2..5863b68 100644 --- a/net/base/mime_util.cc +++ b/net/base/mime_util.cc @@ -138,6 +138,11 @@ static const char* FindMimeType(const MimeInfo* mappings, bool MimeUtil::GetMimeTypeFromExtension(const FilePath::StringType& ext, string* result) const { + // Avoids crash when unable to handle a long file path. See crbug.com/48733. + const unsigned kMaxFilePathSize = 65536; + if (ext.length() > kMaxFilePathSize) + return false; + // We implement the same algorithm as Mozilla for mapping a file extension to // a mime type. That is, we first check a hard-coded list (that cannot be // overridden), and then if not found there, we defer to the system registry. |