diff options
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. |