Skip to content

Commit

Permalink
Update fFile.php
Browse files Browse the repository at this point in the history
Additional detection for unusual (but likely valid) JPEG header formats.
flourishlib#198 (comment)
  • Loading branch information
BrendonKoz authored Jan 10, 2018
1 parent 5540295 commit 5dded7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ static private function determineMimeTypeByContents($content, $extension)

$normal_jpeg = $length > 10 && in_array(substr($content, 6, 4), array('JFIF', 'Exif'));
$photoshop_jpeg = $length > 24 && $_0_4 == "\xFF\xD8\xFF\xED" && substr($content, 20, 4) == '8BIM';
if ($normal_jpeg || $photoshop_jpeg) {
$jpeg_prefix = $_0_3 == "\xFF\xD8\xFF";
if ($normal_jpeg || $photoshop_jpeg || $jpeg_prefix) {
return 'image/jpeg';
}

Expand Down

0 comments on commit 5dded7a

Please sign in to comment.