Index: net/base/mime_util.cc |
=================================================================== |
--- net/base/mime_util.cc (revision 52038) |
+++ net/base/mime_util.cc (working copy) |
@@ -138,6 +138,11 @@ |
bool MimeUtil::GetMimeTypeFromExtension(const FilePath::StringType& ext, |
string* result) const { |
+ // Fixes a crash when xdg_mime library is unable to handle a long file path. |
+ 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. |