This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24890 - "89 [...] A byte with only the highest bit set"
Summary: "89 [...] A byte with only the highest bit set"
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: MIME (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: Unsorted
Assignee: Gordon P. Hemsley
QA Contact: sideshowbarker+mimespec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-02 07:44 UTC by Samuel Bronson
Modified: 2014-09-20 22:05 UTC (History)
1 user (show)

See Also:


Attachments

Description Samuel Bronson 2014-03-02 07:44:38 UTC
http://mimesniff.spec.whatwg.org/#matching-an-image-type-pattern

[[
89 50 4E 47 0D 0A 1A 0A 	FF FF FF FF FF FF FF FF 	None. 	image/png 	A byte with only the highest bit set followed by the string "PNG" followed by CR LF SUB LF, the PNG signature. 
]]

0x89 is *not* a byte with only the highest bit set.  Looking at a random PNG file, it seems that it's the prose that's wrong here.

<http://www.libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-signature> may be of interest here.
Comment 1 Gordon P. Hemsley 2014-03-02 17:20:02 UTC
Interesting; you are correct.

I definitely borrowed that description from somewhere, but I guess not the PNG spec itself. (I was thinking Wikipedia, but the current version of the article doesn't exactly match what I wrote here; perhaps its original description was different and has been changed.)
Comment 2 Gordon P. Hemsley 2014-09-20 22:05:21 UTC
Fixed this by just referring to it as an "error-checking byte":

https://github.com/whatwg/mimesniff/commit/6757c672535a77cf86cbfc3b3dbafb6657d4e4ac