| Index: net/base/mime_sniffer.cc
|
| ===================================================================
|
| --- net/base/mime_sniffer.cc (revision 33698)
|
| +++ net/base/mime_sniffer.cc (working copy)
|
| @@ -579,8 +579,14 @@
|
|
|
| // Now we look in our large table of magic numbers to see if we can find
|
| // anything that matches the content.
|
| - if (SniffForMagicNumbers(content, content_size, result))
|
| + if (SniffForMagicNumbers(content, content_size, result)) {
|
| + // We should never sniff an octet stream as plain text. There are Unix
|
| + // binaries with embedded shell scripts that get sniffed incorrectly,
|
| + // leading to spectacular failures like bug 29354.
|
| + if (type_hint == "application/octet-stream" && "text/plain" == *result)
|
| + result->assign("application/octet-stream");
|
| return true; // We've matched a magic number. No more content needed.
|
| + }
|
|
|
| // Having failed thus far, we're willing to override unknown mime types and
|
| // text/plain.
|
|
|