Craft icon indicating copy to clipboard operation
Craft copied to clipboard

Fix divide by zero errors [$20]

Open inactive123 opened this issue 7 years ago • 3 comments

These manifest themselves primarily on ARM-based systems but they can also manifest on other systems, and they are what is currently preventing the core from working at all on iOS and Android.

Related to issues like this -

https://github.com/libretro/Craft/issues/7

A working proof of concept for this would be if by fixing these issues, the core would then work on either iOS or Android. Either one of the two would be good enough to start with.


There is a $20 open bounty on this issue. Add to the bounty at Bountysource.

inactive123 avatar Mar 31 '17 11:03 inactive123

@bparker06 Did your PR here (https://github.com/libretro/Craft/pull/14) also take care of these issues? There is still a bounty open for this, would be nice to see this finally resolved so it could work on Android/iOS.

inactive123 avatar Aug 07 '17 12:08 inactive123

I just tried the AArch64 build of RA Android and it still crashes there, but probably because of the memcpy referenced in #14 and not a divide by zero.

ghost avatar Aug 27 '18 12:08 ghost

I have dug into this with a debugger. The issue appears to be with the skybox loading in renderer_load_shader. It seems to be passed bad data for the shader that does not compile properly.

The error appears to be coming from these lines:

static void renderer_load_shader(craft_info_t *info, size_t len, size_t len2,
      const char **string, const char **string2)
{
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
   GLuint vert, frag;

   info->program               = glCreateProgram();
   vert                 = glCreateShader(GL_VERTEX_SHADER);
   frag                 = glCreateShader(GL_FRAGMENT_SHADER);

   glShaderSource(vert, (GLsizei)len,  (const GLchar**)string, 0);
   glShaderSource(frag, (GLsizei)len2, (const GLchar**)string2, 0);
   glCompileShader(vert);
   glCompileShader(frag);

   glAttachShader(info->program, vert);
   glAttachShader(info->program, frag);
   glLinkProgram(info->program);
   glDeleteShader(vert);
   glDeleteShader(frag);
#endif
}

jet082 avatar Oct 07 '19 13:10 jet082