<html>
    <head>
      <base href="https://bugs.freedesktop.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 - radv_shader_compile_to_nir doesn't check for bad entry point"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107954">107954</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>radv_shader_compile_to_nir doesn't check for bad entry point
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/Vulkan/radeon
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>freedesktop@treblig.org
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I screwed up my vulkan calling and ended up getting radv_shader_compile_to_nir
to seg because it has:

251 entry_point = spirv_to_nir(spirv, module->size / 4,
             spec_entries, num_spec_entries,
             stage, entrypoint_name,
             &spirv_options, &nir_options);
252 nir = entry_point->shader;
    assert(nir->info.stage == stage);

it's dereferencing 'entry_point' on 252, but if the caller screws up
entry_point can be NULL from spirv_to_nir;

Could this failure be made cleaner?

(Nothing else printed anything first before the seg by default;
spirv_to_nir took a bit of an odd route; it checks b->entry_point = NULL then
call vrn_fail that jumps back to it's setjmp handler and cleans up - so it's
not obvious to me why it also has a ralloc_free(b), return NULL if the vtn_fail
is going to take the setjmp).

My screwup incidentally was a cut-and-paste where I'd copied the code for my
vertex shader for my fragment shader and so I was trying to find the fragment
shader entrypoint in my vertex shader.</pre>
        </div>
      </p>


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

      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>