mt-mods / digistuff

Fork of http://cheapiesystems.com/git/digistuff
3 stars 6 forks source link

crash w/ gpu #44

Open fluxionary opened 10 months ago

fluxionary commented 10 months ago

this was reported by a player calling themselves frogTheSecond

run the following in a luacontroller:

if 'program' == event.type then
  digiline_send("g", {
    {
      command = "createbuffer",
      buffer = 1,
      xsize = 64,
      ysize = 12,
      fill = "ffffff",
    },
    {
      command = "drawline",
      buffer = 1,
      x1 = 100,
      y1 = 100,
      x2 = 1,
      y2 = 12,
      color = "ffffff",
      antialias = true
    }
  })
end

result:

AsyncErr: Lua: Runtime error from mod '??' in callback environment_Step(): ...t/bin/../worlds/rolling_test/worldmods/digistuff/gpu.lua:348: attempt to index a nil value
stack traceback:
    ...t/bin/../worlds/rolling_test/worldmods/digistuff/gpu.lua:348: in function 'runcommand'
    ...t/bin/../worlds/rolling_test/worldmods/digistuff/gpu.lua:566: in function 'action'
    /opt/minetest/bin/../mods/digilines/internal.lua:106: in function 'transmit'
    /opt/minetest/bin/../mods/digilines/init.lua:60: in function 'receptor_send'
    ...est/bin/../mods/mesecons/mesecons_luacontroller/init.lua:749: in function <...est/bin/../mods/mesecons/mesecons_luacontroller/init.lua:743>
    /opt/minetest/bin/../mods/mesecons/mesecons/actionqueue.lua:137: in function 'old_execute'
    ...st/worldmods/mesecons_debug/overrides/mesecons_queue.lua:27: in function 'execute'
    /opt/minetest/bin/../mods/mesecons/mesecons/actionqueue.lua:111: in function </opt/minetest/bin/../mods/mesecons/mesecons/actionqueue.lua:73>
    /opt/minetest/bin/../builtin/common/register.lua:26: in function </opt/minetest/bin/../builtin/common/register.lua:12>
FeXoR-o-Illuria commented 8 months ago

So buffer[point.y] is nil in: https://github.com/mt-mods/digistuff/blob/master/gpu.lua#L348 Can't find any issue with the buffer creation, serialization and storage at first glance.

TheEt1234 commented 8 months ago

So buffer[point.y] is nil in: https://github.com/mt-mods/digistuff/blob/master/gpu.lua#L348 Can't find any issue with the buffer creation, serialization and storage at first glance.

x1 and y1 are bigger than x2 and y2, i think thats the cause (?), or they are out of range, but honestly it (the gpu) should just be rewritten imo

TheEt1234 commented 6 months ago

What causes it and what doesn't (i will be using (x1, y1, x2, y2) to keep it short)

Keep in mind that buffer size is 64 x 64 (10,10,100,120) - doesn't (100, 120, 10, 10) - doesn't (65, 65, 1, 64) - doesn't (100, 500, 1, 64) - doesn't

Well i've gotten some crashes while doing stuff on 11 x 11 before... so (buffer size is now 11 x 11) (13,6,6,6) - does (came from my wireframe renderer) (13,1,1,1) - does

Well i think i get the idea... i will try 64 x 64... (65, 1, 1, 1) - doesn't???

Weird... i guess time to try 63 x 63? (65, 1, 1, 1) - does???

What

buffer size: 62 x 62 (65, 1, 1, 1) - does

oh i see

if the buffer size is less than 64 and x1 is more than that it crashes

Tested on pandorabox

SwissalpS commented 6 months ago

The script snippet in OP doesn't crash game when using #58 Please test the other cases you found @TheEt1234 (or whoever feels like it) and comment on PR #58, thanks.

TheEt1234 commented 5 months ago

The original case that started the issue was fixed, so has the (65, 1, 1, 1) case when buffer size is 63x63

So it's most likely patched