<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO - [SKL] GPU HANG: ecode 9:0:0x85dffffb, in BattleBlockThea [2678], reason: Hang on rcs0, action: reset"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=104462#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEEDINFO "
   title="NEEDINFO - [SKL] GPU HANG: ecode 9:0:0x85dffffb, in BattleBlockThea [2678], reason: Hang on rcs0, action: reset"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=104462">bug 104462</a>
              from <span class="vcard"><a class="email" href="mailto:vadym.shovkoplias@globallogic.com" title="vadym <vadym.shovkoplias@globallogic.com>"> <span class="fn">vadym</span></a>
</span></b>
        <pre>BTW On Ubuntu 17.10 and Ubuntu 16.04 this game crashes on start up with the
following error:

DEBUG: InitGame started
BattleBlockTheater: /media/BGBS/BBT_Linux/Core/MemorySystem.cpp:161: void*
MemoryBlock::Alloc(unsigned int): Assertion `(!"Got request for zero bytes!")'
failed.
Aborted (core dumped)

I noticed that crash is happening when zero length array is allocated in glsl
linker:

src/compiler/glsl/linker.cpp:1209
       InterfaceBlockStageIndex[i] = new int[max_num_buffer_blocks];

Looks like memory allocation is redefined in the game itself and it leads to
crash for zero length array allocation. 

With the following hack game starts properly:

-- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -1148,7 +1148,12 @@ interstage_cross_validate_uniform_blocks(struct
gl_shader_program *prog,
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       struct gl_linked_shader *sh = prog->_LinkedShaders[i];

-      InterfaceBlockStageIndex[i] = new int[max_num_buffer_blocks];
+      if (max_num_buffer_blocks != 0) {
+           InterfaceBlockStageIndex[i] = new int[max_num_buffer_blocks];
+      }

My questing is should we provide any fix for this in mesa or it should be fixed
in BattleBlocks game sources ?</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>