<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Possible incorrect position hint for persistent auto dictionary entry"
   href="https://bugs.llvm.org/show_bug.cgi?id=49992">49992</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Possible incorrect position hint for persistent auto dictionary entry
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>fuzzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>meumertzheim@code-intelligence.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In MutationDispatcher::RecordSuccessfulMutationSequence in FuzzerMutate.cpp,
the persistent auto dictionary entries are recorded with a fixed position hint
of 1 (see
<a href="https://github.com/llvm/llvm-project/blob/1ede08a290ac70b06df6887a39c1a22ccbfcc09f/compiler-rt/lib/fuzzer/FuzzerMutate.cpp#L482">https://github.com/llvm/llvm-project/blob/1ede08a290ac70b06df6887a39c1a22ccbfcc09f/compiler-rt/lib/fuzzer/FuzzerMutate.cpp#L482</a>).
As a result, in 50% of the cases, Mutate_AddWordFromPersistentAutoDictionary
will attempt to apply the entry right after the first byte of the input.

Using a fixed position at this point is surprising and may have resulted from a
confusion with a no longer implemented, separate success count hinted at by a
commented out line of code above (see
<a href="https://github.com/llvm/llvm-project/blob/1ede08a290ac70b06df6887a39c1a22ccbfcc09f/compiler-rt/lib/fuzzer/FuzzerMutate.cpp#L477">https://github.com/llvm/llvm-project/blob/1ede08a290ac70b06df6887a39c1a22ccbfcc09f/compiler-rt/lib/fuzzer/FuzzerMutate.cpp#L477</a>). 

The fixed position 1 could be replaced with either DE->GetPositionHint()
(position hint copied from the entry) or std::numeric_limits<size_t>::max() (no
position hint). It remains to be determined which of these would be more
appropriate. If needed, I could try to get some data on this via fuzzbench.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>