<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>19800</bug_id>
          
          <creation_ts>2012-10-31 18:58:50 +0000</creation_ts>
          <short_desc>&quot;If the number of bytes in mask is not equal to length, return false&quot; can&apos;t ever happen?</short_desc>
          <delta_ts>2012-11-01 17:19:10 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>MIME</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P4</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ian &apos;Hixie&apos; Hickson">ian</reporter>
          <assigned_to name="Gordon P. Hemsley">gphemsley</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
          
          <qa_contact>sideshowbarker+mimespec</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>77538</commentid>
    <comment_count>0</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-10-31 18:58:50 +0000</bug_when>
    <thetext>In step 5 of the &quot;Pattern matching algorithm&quot;:

   &quot;5. If the number of bytes in mask is not equal to length, return false&quot;

.../length/ is equal to the number of bytes in /pattern/, which had better always be the same length as /mask/!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77541</commentid>
    <comment_count>1</comment_count>
    <who name="Gordon P. Hemsley">gphemsley</who>
    <bug_when>2012-10-31 19:18:31 +0000</bug_when>
    <thetext>This was a built-in test to prevent against typos in the spec or in the implementation.

I included it as a safety net, but if you think it&apos;d be better without it, I can remove it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77597</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-10-31 22:25:22 +0000</bug_when>
    <thetext>It&apos;ll cause implementors to add code that has no effect. I recommend commenting it out at best. After all, if the patterns are ever wrong, then you don&apos;t want the implementations to skip them, you want them to tell you to fix them!

What I sometimes do is add non-normative statements that work a bit like assertions, e.g. &quot;At this point /length/ will also equal the number of bytes in mask&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77687</commentid>
    <comment_count>3</comment_count>
    <who name="Gordon P. Hemsley">gphemsley</who>
    <bug_when>2012-11-01 17:19:10 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; What I sometimes do is add non-normative statements that work a bit like
&gt; assertions, e.g. &quot;At this point /length/ will also equal the number of bytes
&gt; in mask&quot;.

I opted to modify step 4 to read:

&quot;Let length be the number of bytes in pattern, which is equal to the number of bytes in mask.&quot;

https://github.com/whatwg/mimesniff/commit/5c0c4c9259c6837837ef575b512fb41d3ff3824a</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>