noxfutura icon indicating copy to clipboard operation
noxfutura copied to clipboard

Subtraction overflow in build_escape_pod

Open dodomorandi opened this issue 3 years ago • 2 comments

Running the game in debug triggers a subtraction overflow at nox_planet/src/region/builder/buildings.rs:21:26 (and obviously the following line is affected as well). I imagine that the intended behavior is to overflow and take the modulo of layer height/width, right?

I can send you a PR if you want, I know that this is you personal project, so I am happy to give some tiny help and I don't get offended if you say no ☺️

In any case, I listened to the podcast in which you were talking about this project. Really, really awesome work! Thank you for your efforts and your passion ❤️

P.S.: I just changed the initialization process to use wgpu::BackendBit::DX12 to wgpu::BackendBit::PRIMARY to make it work on Mac, everything seems fine!

P.P.S.: Uh, it looks like there are some similar issues around, I just got another overflow in nox_planet/src/region/builder/flags.rs:85:43 -- these are tricky to find without the overflow checker at runtime (almost impossible in C++ 🙄).

dodomorandi avatar Aug 25 '20 10:08 dodomorandi

Sadly, there are a few overflows (the rivers code is particularly bad). Right now, it's a 1:1 port of a lot of C++ code - so I'm tracking those down. I'm working away in a branch that will change the structure of some of the project (it grabs the latest WGPU and Legion, which require a lot of reworking anyway). My plan is to get to these issues once that is a bit more solidified.

Thanks - and I'm glad you're enjoying it. :-) (I do have a bad habit of running it in Release mode for speed and not seeing all of these pop up)

thebracket avatar Aug 25 '20 12:08 thebracket

The current build needs some other work (I'm finding that array textures aren't working out side of Vulkan land), but it should have fixed the overruns!

thebracket avatar Nov 19 '20 13:11 thebracket